Function xorWith

  • This method is like xor except that it accepts comparator which is invoked to compare elements of arrays. The order of result values is determined by the order they occur in the arrays. The comparator is invoked with two arguments: (arrVal, othVal).

    Type Parameters

    • T

    Parameters

    • comparator: Function

      The comparator invoked per element.

    • ...arrays: T[][]

      The arrays to inspect.

    Returns T[]

    Returns the new array of filtered values.

    5.7.0

    [[difference]], [[union]], [[unionBy]], [[unionWith]], [[without]], [[xor]], [[xorBy]]

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

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