Materialises source into a native Set.
Set
Type of elements within source.
The source iterable.
A set containing the distinct elements from source.
The entire sequence is enumerated immediately and duplicate elements are collapsed using JavaScript's SameValueZero semantics.
SameValueZero
const numbers = [1, 2, 2, 3, 1];const set = toSet(numbers);console.log(Array.from(set)); // [1, 2, 3] Copy
const numbers = [1, 2, 2, 3, 1];const set = toSet(numbers);console.log(Array.from(set)); // [1, 2, 3]
Materialises source into a native
Set.