-
Notifications
You must be signed in to change notification settings - Fork 1
split
Subhajit Sahu edited this page Feb 3, 2021
·
29 revisions
Breaks iterable considering test as separator. 🏃 📼 📦 🌔 📒
iterable.split(x, ft);
// x: an iterable
// ft: test function (v, i, x)
const iterable = require("extra-iterable");
var x = [1, 2, 2, 3, 5, 4, 4, 7];
[...iterable.split(x, v => v % 2 === 0)];
// [ [ 1 ], [ 3, 5 ], [ 7 ] ]
var x = [2, 4, 5, 6, 8];
[...iterable.split(x, v => v % 2 === 0)];
// [ [ 5 ] ]