Skip to content
Subhajit Sahu edited this page Jun 11, 2020 · 12 revisions

Keeps first n entries only. 🏃 [:vhs:] 📦 🌔 📒

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

object.take$(x, [n]);
// x: an object (updated)
// n: number of entries (1)
// --> x
const object = require('extra-object');

var x = {a: 1, b: 2, c: 3, d: 4, e: 5};
object.take$(x, 2);
// { a: 1, b: 2 }

x;
// { a: 1, b: 2 }

var x = {a: 1, b: 2, c: 3, d: 4, e: 5};
object.take$(x, 3);
// { a: 1, b: 2, c: 3 }

references

Clone this wiki locally