UNPKG

npx-run

Version:

Easily run scripts using npx.

33 lines (27 loc) 525 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.groups = groups; exports.headTail = headTail; function* groups(items, split) { let collected = []; for (const item of items) { if (split(item)) { yield collected; collected = []; } collected.push(item); } if (collected.length) { yield collected; } } function* headTail(iterable) { const iter = iterable[Symbol.iterator](); const { value } = iter.next(); yield value; yield iter; }