• Creates a duplicate-free version of an array, it accepts iteratee which is invoked for each element in array to generate the criterion by which uniqueness is computed.

    Type Parameters

    • T extends Record<string, any>

    Parameters

    • array: T[]
    • predicate: string | Function

    Returns T[]

    {Array}

    Example

    uniqBy([2.1, 1.2, 2.3], Math.floor);
    // returns [2.1, 1.2]

    Example

    uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
    returns [{ 'x': 1 }, { 'x': 2 }]

Generated using TypeDoc