Package: effect
Module: MutableHashSet
Removes the specified value from the MutableHashSet, mutating the set in place. If the value doesn’t exist, the set remains unchanged.
When to use
Use to delete a value from a mutable set if it is present.
Example (Removing a value)
import { MutableHashSet } from "effect"
const set = MutableHashSet.make("apple", "banana", "cherry")
console.log(MutableHashSet.size(set)) // 3
// Remove existing value
MutableHashSet.remove(set, "banana")
console.log(MutableHashSet.size(set)) // 2
console.log(MutableHashSet.has(set, "banana")) // false
// Remove non-existent value (no effect)
MutableHashSet.remove(set, "grape")
console.log(MutableHashSet.size(set)) // 2
// Pipe-able version
const removeFruit = MutableHashSet.remove("apple")
removeFruit(set)
console.log(MutableHashSet.size(set)) // 1
Signature
declare const remove: { <V>(key: V): (self: MutableHashSet<V>) => MutableHashSet<V>; <V>(self: MutableHashSet<V>, key: V): MutableHashSet<V>; }
Since v2.0.0