1
0
mirror of https://github.com/vercel/commerce.git synced 2025-03-17 16:02:33 +00:00
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
}