@extra-array/union-on

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

Usage no npm install needed!

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

README

Gives values present in any array. :running: :vhs: :package: :moon:

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

array.unionOn(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];
array.unionOn(x, [2, 3, 5]);
// [1, 2, 3, 4, 5]

var x = [1, 2, 3, 4];
array.unionOn(x, [-2, -3, -5], v => Math.abs(v));
// [1, 2, 3, 4, -5]

references