UNPKG

@thi.ng/grid-iterators

Version:

2D grid and shape iterators w/ multiple orderings

11 lines (10 loc) 291 B
import { map } from "@thi.ng/transducers/map"; import { range2d } from "@thi.ng/transducers/range2d"; import { __opts } from "./utils.js"; const rows2d = (opts) => { const { cols, rows, tx } = __opts(opts); return map((p) => tx(p[0], p[1]), range2d(cols, rows)); }; export { rows2d };