map
Creates a new Set with each value transformed by a function. If two values transform to the same result, duplicates collapse — the returned Set may be smaller than the input.
Available since v3.0.3
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
set | ReadonlySet<T> | The Set to transform |
fn | function | Function invoked with each value, returning the new value |
Returns
Section titled “Returns”Set<R> — A new Set of transformed values
Examples
Section titled “Examples”Transform every value
Section titled “Transform every value”Creates a new Set with each value transformed by a function.
Duplicates collapse
Section titled “Duplicates collapse”If two values transform to the same result, the Set naturally deduplicates.
