@tempots/std
uniqueByPrimitive() function
Returns an array of distinct elements from the input array based on the provided predicate.
Signature:
uniqueByPrimitive: (values: T[], predicate: (a: T) => string | number | symbol) => T[]
Parameters
Parameter |
Type |
Description |
---|---|---|
values |
T[] |
The input array. |
predicate |
(a: T) => string | number | symbol |
The predicate function used to determine uniqueness. |
Returns: T[]
An array of distinct elements.