Options
All
  • Public
  • Public/Protected
  • All
Menu

Module uniqWith

Index

References

Functions Array

References

Renames and re-exports __type

Array Functions

  • uniqWith<T>(array: T[], comparator: Comparator<T>): T[]
  • This method is like uniq except that it accepts comparator which is invoked to compare elements of array. The order of result values is determined by the order they occur in the array. The comparator is invoked with two arguments: (arrVal, othVal).

    since

    5.12.0

    see

    uniq, uniqBy

    example
    const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]

    uniqWith(objects, isEqual)
    // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]

    Type parameters

    • T = any

    Parameters

    • array: T[]

      The array to inspect.

    • comparator: Comparator<T>

      The comparator invoked per element.

    Returns T[]

    Returns the new duplicate free array.