UNPKG

@klodianimeri/pipejs

Version:

Pipe functions that provide convenient and efficient ways to work with iterators.

16 lines (13 loc) 481 B
import { Pipe } from "../pipe.js"; import { assertSync, push, Yields } from "../util/index.js"; export function concat(source: Iterable<any, any, unknown>): Pipe { assertSync(source); return () => { return (result: IteratorResult<any>): IteratorResult<any> | Array<IteratorResult<any>> => { if (result?.done) { return push(Yields(Array.from(source)), result); } return result; }; } }