This method is like pullAll except that it accepts comparator which is invoked to compare elements of array to values. The comparator is invoked with two arguments: (arrVal, othVal).
pullAll
comparator
array
values
Note: Unlike differenceWith, this method mutates array.
differenceWith
The array to modify.
The values to remove.
The comparator invoked per element.
Returns array.
5.11.0
[[pull]], [[pullAll]], [[pullAllBy]], [[pullAt]], [[remove]], [[reject]]
const array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]pullAllWith(array, [{ 'x': 3, 'y': 4 }], isEqual)console.log(array)// => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] Copy
const array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]pullAllWith(array, [{ 'x': 3, 'y': 4 }], isEqual)console.log(array)// => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
This method is like
pullAll
except that it acceptscomparator
which is invoked to compare elements ofarray
tovalues
. The comparator is invoked with two arguments: (arrVal, othVal).Note: Unlike
differenceWith
, this method mutatesarray
.