-
Notifications
You must be signed in to change notification settings - Fork 1
concat$
Subhajit Sahu edited this page Dec 5, 2022
·
15 revisions
Append entries from maps, preferring last.
function concat$(x, ...ys)
// x: a map (updated)
// ys: other maps
const map = require('extra-map');
var x = new Map([['a', 1], ['b', 2]]);
var y = new Map([['c', 3], ['d', 4]]);
map.concat$(x, y);
// → Map(4) { 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4 }
x;
// → Map(4) { 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4 }
var x = new Map([['a', 1], ['b', 2]]);
var y = new Map([['c', 3], ['d', 4]]);
var z = new Map([['d', 40], ['e', 50]]);
map.concat$(x, y, z);
// → Map(5) { 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 40, 'e' => 50 }