Basic usage

Given a start, end, and optional step size, returns a list that contains numbers from start to end by step size (which defaults to one). A hat tip to Python’s range functionality. Uses _.range under the hood.

import { list } from 'radash'

for (const i of list(0, 200, 10)) {
  console.log(i) // => 0, 10, 20, 30 ... 190, 200
}

for (const i of list(0, 5)) {
  console.log(i) // => 0, 1, 2, 3, 4, 5
}

Testing

This _.list function is 100% covered by tests. See them and contribute at GitHub.

Source

See the source for _.list on GitHub.