ezyVet Javascript Helper Library Documentation
    Preparing search index...

    Function uniqWith

    • Creates a duplicate-free version of an array, it accepts comparator which is invoked to compare elements of array

      Type Parameters

      • T

      Parameters

      • array: T[]
      • comparator: Function

      Returns T[]

      unique array

      uniqWith(
      [{ x: 1, y: 2 }, { x: 1, y: 3 }, { x: 2, y: 4 }, { x: 1, y: 2 }],
      (arrayValue, otherValue) => arrayValue.x === otherValue.x
      );
      // returns [{ x: 1, y: 2 }, { x: 2, y: 4 }]