UNPKG

@thi.ng/transducers

Version:

Collection of ~170 lightweight, composable transducers, reducers, generators, iterators for functional data transformations

17 lines (16 loc) 346 B
import { compR } from "./compr.js"; import { __iter } from "./iterator.js"; function dropWhile(...args) { return __iter(dropWhile, args) || ((rfn) => { const r = rfn[2]; const pred = args[0]; let ok = true; return compR( rfn, (acc, x) => (ok = ok && pred(x)) ? acc : r(acc, x) ); }); } export { dropWhile };