A simple JavaScript component to iterate an array round robin.
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib added splice and spliceCurrent for removing array elements while keep… Dec 17, 2013
test
.gitignore initial commit Oct 15, 2013
.npmignore
CHANGELOG.md
LICENSE initial commit Oct 15, 2013
README.md
bower.json 0.1.0 Dec 26, 2013
component.json 0.1.0 Dec 26, 2013
package.json 0.1.0 Dec 26, 2013

README.md

rr

A simple JavaScript component to iterate an array round robin.

Why?

Sometimes you want to loop over an array and start at the beginning again.

Install

Node.js/Browserify

npm install --save rr

Component

component install jprichardson/rr

Bower

bower install rr

Script

<script src="/path/to/rr.js"></script>

Usage

rr(array, [lastIndex])

Example

var rr = require('rr')

var list = ['a', 'b', 'c']
console.log(rr(list)) //a
console.log(rr(list)) //b
console.log(rr(list)) //c
console.log(rr(list)) //a

console.log(rr(list,1)) //c
console.log(rr(list,2)) //a 

splice(array, idx, len)

spliceCurrent(array, len)

License

(MIT License)

Copyright 2013, JP Richardson