filter
Creates a new Set containing only the values for which the predicate returns true.
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 filter |
predicate | function | Function invoked with each value — return true to keep it |
Returns
Section titled “Returns”Set<T> — A new Set with only the matching values
Examples
Section titled “Examples”Keep only even values
Section titled “Keep only even values”Creates a new Set with only the values that satisfy the predicate.
