Skip to content
Subhajit Sahu edited this page Jun 17, 2020 · 15 revisions

Gives entries present in any entries. 🏃 📼 📦 🌔 📒

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

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

var x = new Map([['a', 1], ['b', 2], ['c', 3]]);
var y = new Map([['b', 20], ['c', 30], ['d', 40]]);
map.union(x, y);
// Map(4) { 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 40 }

map.union(x, y, (a, b) => b);
// Map(4) { 'a' => 1, 'b' => 20, 'c' => 30, 'd' => 40 }

references

Clone this wiki locally