Options
All
  • Public
  • Public/Protected
  • All
Menu

Module src/arrays/uniqWith

Index

Functions

Functions

Const uniqWith

  • uniqWith<T>(array: Array<T>, comparator: Function): T[]
  • Creates a duplicate-free version of an array, it accepts comparator which is invoked to compare elements of array

    example

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

    Type parameters

    • T

    Parameters

    • array: Array<T>
    • comparator: Function

    Returns T[]

    unique array

Generated using TypeDoc