• This method is like _.difference except that it accepts comparator which is invoked to compare elements of array to values. The order and references of result values are determined by the first array. The comparator is invoked with two arguments: (arrVal, othVal).

    Type Parameters

    • T1
    • T2

    Parameters

    • array: undefined | null | List<T1>
    • Optionalvalues: List<T2>

      The arrays to inspect.

    • Optionalcomparator: Comparator2<T1, T2>

      The comparator invoked per element.

    Returns T1[]

    Returns the new array of filtered values.

    var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];

    _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
    // => [{ 'x': 2, 'y': 1 }]
  • Type Parameters

    • T1
    • T2
    • T3

    Parameters

    • array: undefined | null | List<T1>
    • values1: List<T2>
    • values2: List<T3>
    • comparator: Comparator2<T1, T2 | T3>

    Returns T1[]

    _.differenceWith

  • Type Parameters

    • T1
    • T2
    • T3
    • T4

    Parameters

    • array: undefined | null | List<T1>
    • values1: List<T2>
    • values2: List<T3>
    • ...values: (List<T4> | Comparator2<T1, T2 | T3 | T4>)[]

    Returns T1[]

    _.differenceWith

  • Type Parameters

    • T

    Parameters

    • array: undefined | null | List<T>
    • ...values: List<T>[]

    Returns T[]

    _.differenceWith