Hyperlinkv0.8.0-beta.28

Predicate

Predicate.isSetfunctioneffect/Predicate.ts:473
(input: unknown): input is Set<unknown>

Checks whether a value is a Set.

When to use

Use when you need a Predicate runtime guard for Set values.

Details

Uses instanceof Set.

Example (Guarding a Set)

import { Predicate } from "effect"

const data: unknown = new Set([1, 2])

if (Predicate.isSet(data)) {
  console.log(data.size)
}
export function isSet(input: unknown): input is Set<unknown> {
  return input instanceof Set
}