4
0
forked from crowetic/commerce
commerce/lib/range-map.ts

8 lines
162 B
TypeScript
Raw Normal View History

2020-10-19 13:49:02 -05:00
export default function rangeMap(n: number, fn: (i: number) => any) {
const arr = []
while (n > arr.length) {
arr.push(fn(arr.length))
}
return arr
}