gamut

Create a new array of values in a range.

  • gamut

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
gamut
201.1.08 years ago9 years agoMinified + gzip package size for gamut in KB

Readme

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]