stack

Home > @infiniteobjects/core-library-web > Arrays > uniqBy

Arrays.uniqBy() method

This method is like Arrays.uniq except that it accepts iteratee which is invoked for each element in collection to generate the criterion by which uniqueness is computed.

Signature:

static uniqBy<T, R = unknown>(collection: T[], iteratee: (item: T) => R): T[];

Parameters

Parameter Type Description
collection T[]  
iteratee (item: T) => R  

Returns:

T[]

Remarks

Is the consumer responsability to provide an iteratee that create unique values