UNPKG

@thi.ng/transducers

Version:

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

14 lines (13 loc) 287 B
import { __iter } from "./iterator.js"; import { mapIndexed } from "./map-indexed.js"; function indexed(...args) { const iter = __iter(indexed, args); if (iter) { return iter; } const from = args[0] || 0; return mapIndexed((i, x) => [from + i, x]); } export { indexed };