Skip to content

Commit

Permalink
feat(transducers): add normRange2
Browse files Browse the repository at this point in the history
  • Loading branch information
nkint committed Aug 21, 2020
1 parent b9887a3 commit 1125930
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/transducers/src/iter/norm-range.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,18 @@ export function* normRange(
}
}
}

export function* normRange2(
nx: number,
ny: number,
includeLastX: boolean = true,
includeLastY: boolean = true,
) {
for (let y of normRange(ny, includeLastY)) {
const rx = normRange(nx, includeLastX)
for (let x of rx) {
yield [x, y] as [number, number]
}
}
}

0 comments on commit 1125930

Please sign in to comment.