-
Notifications
You must be signed in to change notification settings - Fork 1
from$
Subhajit Sahu edited this page Dec 5, 2022
·
11 revisions
Convert entries to map.
Alternatives: from, from$.
Similar: from, fromLists, fromKeys, fromValues.
function from$(x)
// x: entries (updateable is map!)
const map = require('extra-map');
var es = [['a', 1], ['b', 2], ['c', 3]];
map.from$(es);
// → Map(3) { 'a' => 1, 'b' => 2, 'c' => 3 }
var x = new Map(es);
var a = map.from$(x);
// a === x (map is reused)
a.set('a', 10);
x;
// → Map(3) { 'a' => 10, 'b' => 2, 'c' => 3 }