UNPKG

@thi.ng/transducers

Version:

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

15 lines (14 loc) 199 B
function* symmetric(src) { let head = void 0; for (let x of src) { head = { x, n: head }; yield x; } while (head) { yield head.x; head = head.n; } } export { symmetric };