@extra-array/difference-on
v2.7.8
Published
Gives values of array not present in another.
Downloads
189
Maintainers
Readme
Gives values of array not present in another. :running: :vhs: :package: :moon:
Alternatives: compare, map. This is part of package extra-array.
array.differenceOn(x, y, [fn], [ths]);
// x: an array
// y: another array
// fn: map function (v, i, x)
// ths: this argument
const array = require('extra-array');
var x = [1, 2, 3, 4, 5];
array.differenceOn(x, [2, 4]);
// [1, 3, 5]
array.differenceOn(x, [-2, -4]);
// [1, 2, 3, 4, 5]
array.differenceOn(x, [-2, -4], v => Math.abs(v));
// [1, 3, 5]