circ-iter

2.0.0 • Public • Published

circ-iter

Simple circular Array and String iterator.

Installation

npm install circ-iter

Usage

/* With an Array */
 
const next = require('circ-iter')([1, 2, 3])
 
next() // => 1
    next() // => 2
        next() // => 3
 
next() // => 1
    next() // => 2
        next() // => 3
 
/* With a String */
 
const next = require('circ-iter')('abc')
 
next() // => 'a'
    next() // => 'b'
        next() // => 'c'
 
next() // => 'a'
    next() // => 'b'
        next() // => 'c'
 

License

WTFPL – Do What the F*ck You Want to Public License.

Made with ❤️ by @MarkTiedemann.

Package Sidebar

Install

npm i circ-iter

Weekly Downloads

1

Version

2.0.0

License

WTFPL

Last publish

Collaborators

  • marktiedemann