1.1.0 • Published 7 years ago

rangey v1.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

rangey

Python 3.x range for ES6

NPM version Build Status js-standard-style

Installation | Usage | Example | License

Installation

With npm:

npm install rangey --save

Note: You need an engine that supports ES6 (e.g. Babel or Node 4.0+).

Usage

rangey.range([start, ]stop[, step])

Starts a loop on start, incrementing by step until reaching stop.

This is a generator function that yields values one by one (and does not take up memory for an array)

Defaults:

  • start = 0
  • step = 1

rangey.listOf(generator)

Appends all values from generator into an array.

Example

'use strict'

import { range, listOf } from 'rangey'

for (let i of range(4)) {
  // 0, 1, 2, 3
}

listOf(range(1, 5, 0.5)) // 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5

License

MIT

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago