Skip to content
Subhajit Sahu edited this page Dec 5, 2022 · 12 revisions

Remove first n entries (default order).

Alternatives: drop, drop$.
Similar: take, drop.


function drop$(x, n)
// x: a map (updated)
// n: number of entries [1]
const map = require('extra-map');

var x = new Map([['a', 1], ['b', 2], ['c', 3], ['d', 4], ['e', 5]]);
map.drop$(x, 2);
// → Map(3) { 'c' => 3, 'd' => 4, 'e' => 5 }

x;
// → Map(3) { 'c' => 3, 'd' => 4, 'e' => 5 }

var x = new Map([['a', 1], ['b', 2], ['c', 3], ['d', 4], ['e', 5]]);
map.drop$(x, 3);
// → Map(2) { 'd' => 4, 'e' => 5 }


References

Clone this wiki locally