@extra-lists/union.min

Gives lists present in any lists. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Usage no npm install needed!

<script type="module">
  import extraListsUnionMin from 'https://cdn.skypack.dev/@extra-lists/union.min';
</script>

README

Gives lists present in any lists. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Similar: union, intersection, difference, symmetricDifference, isDisjoint.

This is part of package extra-lists.

This is browserified, minified version of @extra-lists/union.
It is exported as global variable lists_union.
CDN: unpkg, jsDelivr.


lists.union(x, y, [fc]);
// x:  lists
// y:  another lists
// fc: combine function (a, b)
const lists = require('extra-lists');

var x = [['a', 'b', 'c'], [1, 2, 3]];
var y = [['b', 'c', 'd'], [20, 30, 40]];
lists.union(x, y).map(v => [...v]);
// [ [ 'a', 'b', 'c', 'd' ], [ 1, 2, 3, 40 ] ]

lists.union(x, y, (a, b) => b).map(v => [...v]);
// [ [ 'a', 'b', 'c', 'd' ], [ 1, 20, 30, 40 ] ]


References