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).
xor
comparator
arrays
The comparator invoked per element.
Rest
The arrays to inspect.
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 }] Copy
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 }]
This method is like
xor
except that it acceptscomparator
which is invoked to compare elements ofarrays
. The order of result values is determined by the order they occur in the arrays. The comparator is invoked with two arguments: (arrVal, othVal).