UNPKG

rambda

Version:

Lightweight and faster alternative to Ramda with included TS definitions

11 lines (10 loc) 272 B
export function range(a, b) { const start = b === undefined ? 0 : a const end = b === undefined ? a : b if (end === start) return [start] if (end < start) { return [] } const len = end - start return Array.from({ length: len + 1 }, (_, i) => start + i) }