-
Notifications
You must be signed in to change notification settings - Fork 1
take$
Subhajit Sahu edited this page Dec 2, 2022
·
14 revisions
Keep first n values only (default order).
function take$(x, n)
// x: a set (updated)
// n: number of values [1]
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 }