-
Notifications
You must be signed in to change notification settings - Fork 1
take$
Subhajit Sahu edited this page Jun 13, 2020
·
14 revisions
Keeps first n entries only. 🏃 📼 📦 🌔 📒
map.take$(x, [n]);
// x: a map (updated)
// n: number of entries (1)
// --> x
const map = require('extra-map');
var x = new Map([['a', 1], ['b', 2], ['c', 3], ['d', 4]]);
map.take$(x, 2);
// Map(2) { 'a' => 1, 'b' => 2 }
x;
// Map(2) { 'a' => 1, 'b' => 2 }
var x = new Map([['a', 1], ['b', 2], ['c', 3], ['d', 4]]);
map.take$(x, 3);
// Map(3) { 'a' => 1, 'b' => 2, 'c' => 3 }