rangey

1.1.0 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i rangey

Weekly Downloads

0

Version

1.1.0

License

MIT

Last publish

Collaborators

  • shaynair