@extra-array/difference-on.min

Gives values of array not present in another. [:running:] [:vhs:] [:package:] [:moon:] > Alternatives: [compare], [map]. > This is part of package [extra-array].

Usage no npm install needed!

<script type="module">
  import extraArrayDifferenceOnMin from 'https://cdn.skypack.dev/@extra-array/difference-on.min';
</script>

README

Gives values of array not present in another. :running: :vhs: :package: :moon:

Alternatives: compare, map.
This is part of package extra-array.

This is browserified, minified version of @extra-array/difference-on.
It is exported as global variable array_differenceOn.
CDN: unpkg, jsDelivr.

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]

references