Creates a generator that yields unique values from the source iterable based on keys generated by the provided function.
The type of elements in the source iterable.
Function that generates a string or number key for each element and its index.
A generator function that takes an iterable and yields unique elements.
Unique elements from the source iterable, where uniqueness is determined by the key function.
G.pipe( [1, 2, 2, 3, 4, 4, 5], G.unique(x => x), G.array) // [1, 2, 3, 4, 5]G.pipe( [{id: 1, name: 'A'}, {id: 2, name: 'B'}, {id: 1, name: 'C'}], G.unique(x => x.id), G.array) // [{id: 1, name: 'A'}, {id: 2, name: 'B'}] Copy
G.pipe( [1, 2, 2, 3, 4, 4, 5], G.unique(x => x), G.array) // [1, 2, 3, 4, 5]G.pipe( [{id: 1, name: 'A'}, {id: 2, name: 'B'}, {id: 1, name: 'C'}], G.unique(x => x.id), G.array) // [{id: 1, name: 'A'}, {id: 2, name: 'B'}]
Creates a generator that yields unique values from the source iterable based on keys generated by the provided function.