1.1.0 • Published 9 years ago

gamut v1.1.0

Weekly downloads
396
License
ISC
Repository
github
Last release
9 years ago

gamut Build Status Dependency Status Coverage Status

Create a new array of values in a range.

Usage

var gamut = require('gamut')

gamut(5) // [0, 1, 2, 3, 4]

gamut(1, 10) // [1, 2, 3, 4, 5, 6, 7, 8, 9]

gamut(0, 10, 2) // [0, 2, 4, 6, 8]

gamut('0..5') // [0, 1, 2, 3, 4]

gamut(5, function (i) {
  return i
}) // [0, 1, 2, 3, 4]

gamut(1, 5, function (i) {
  return {n: i}
}) // [{n: 1}, {n: 2}, {n: 3}, {n: 4}]

gamut('0..5', function (i) {
    return 1
}) // [1, 1, 1, 1, 1]

// With step 2
gamut(1, 5, 2, function (i) {
  return {n: i}
}) // [{n: 1}, {n: 3}]

gamut('0..5', 2, function (i) {
    return 1
}) // [1, 1, 1]
1.1.0

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago