UNPKG

210 BJavaScriptView Raw
1function* cut(x, ft) {
2 var i = -1, a = [];
3 for (var v of x) {
4 if (ft(v, ++i, x)) {
5 yield a;
6 a = [];
7 }
8 a.push(v);
9 }
10 yield a;
11}
12export default cut;