/**
* Maps over the values of the `HashSet` using the specified function.
*
* @tsplus static HashSet.Aspects map
* @tsplus pipeable HashSet map
*/
export function map(f: (a: A) => B) {
return (self: HashSet): HashSet => {
const set = HashSet.empty()
return set.mutate((_) => {
self.forEach((e) => {
const v = f(e)
if (!_.has(v)) {
_.add(v)
}
})
})
}
}