roundround
A dead simple round-robin array iterator
Last updated 13 years ago by watson .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install roundround 
SYNC missed versions from official npm registry.

RoundRound

A dead simple round-robin array iterator

buildstatus

Install

npm install roundround

Usage

var roundround = require('roundround');

// Initialize RoundRound with any Array (null or undefined are ok as well, so no
// guards necessary)
var rr = roundround([1,2,3]);

// Then call the result to get the next element in the array
rr(); // => 1
rr(); // => 2
rr(); // => 3

// When reaching the end of the internal array, the iterator starts over from
// the beginning
rr(); // => 1

// You can also specify an index from where RoundRound should start
var rr = roundround([1,2,3], 1);
rr(); // => 2

License

MIT

Current Tags

  • 0.2.0                                ...           latest (13 years ago)

2 Versions

  • 0.2.0                                ...           13 years ago
  • 0.1.0                                ...           13 years ago
Maintainers (1)
Downloads
Total 6
Today 0
This Week 0
This Month 6
Last Day 0
Last Week 1
Last Month 0
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (0)
None

© 2010 - cnpmjs.org x YWFE | Home | YWFE