-
Notifications
You must be signed in to change notification settings - Fork 0
take
Subhajit Sahu edited this page Jun 17, 2020
·
15 revisions
Keeps first n entries only. 🏃 📼 📦 🌔 📒
Alternatives: [take], [take$].
Similar: [take], [drop].
entries.take(x, [n]);
// x: entries
// n: number of entries (1)
const entries = require('extra-entries');
var x = [['a', 1], ['b', 2], ['c', 3], ['d', 4]];
[...entries.take(x, 2)];
// [ [ 'a', 1 ], [ 'b', 2 ] ]
[...entries.take(x, 3)];
// [ [ 'a', 1 ], [ 'b', 2 ], [ 'c', 3 ] ]