effect-io-ai

Package: effect
Module: MutableHashSet

MutableHashSet.has

Checks whether the MutableHashSet contains the specified value.

When to use

Use to test whether a mutable set currently contains a value.

Details

Membership follows the same hashing and equality rules as the underlying MutableHashMap.

Example (Checking for a value)

import { MutableHashSet } from "effect"

const set = MutableHashSet.make("apple", "banana", "cherry")

console.log(MutableHashSet.has(set, "apple")) // true
console.log(MutableHashSet.has(set, "grape")) // false

// Pipe-able version
const hasApple = MutableHashSet.has("apple")
console.log(hasApple(set)) // true

// Check after adding
MutableHashSet.add(set, "grape")
console.log(MutableHashSet.has(set, "grape")) // true

See

Signature

declare const has: { <V>(key: V): (self: MutableHashSet<V>) => boolean; <V>(self: MutableHashSet<V>, key: V): boolean; }

Source

Since v2.0.0