ezyVet Javascript Helper Library Documentation
    Preparing search index...

    Function uniqBy

    • 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}

      uniqBy([2.1, 1.2, 2.3], Math.floor);
      // returns [2.1, 1.2]
      uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
      returns [{ 'x': 1 }, { 'x': 2 }]