An iterable Range class.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cjs
esm
test
.gitignore
.npmignore
.travis.yml
LICENSE
README.md
index.js
min.js
package.json

README.md

class Range

Build Status Coverage Status WebReflection status

An iterable Range class.

The usage is as simple as new Range(start = 0, end = Infinity, step = 1), with a .for(iterable) method.

import Range from 'class-range';

for (const i of new Range(0, 3))
  console.log(i); // 0, 1, 2

for (const c of new Range(1, 3).for('abcd'))
  console.log(c); // "b", "c"