Skip to content
Subhajit Sahu edited this page Jun 13, 2020 · 14 revisions

Keeps first n values only. 🏃 📼 📦 🌔 📒

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

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

var x = new Set([1, 2, 3, 4]);
set.take$(x, 2);
// Set(2) { 1, 2 }

x;
// Set(2) { 1, 2 }

var x = new Set([1, 2, 3, 4]);
set.take$(x, 3);
// Set(3) { 1, 2, 3 }

references

Clone this wiki locally