0.9.0 • Published 7 years ago

madoos-array-iterator v0.9.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

madoos-array-iterator

Extends the instance of an array to behave like an iterator

Getting Started

To install:

npm i --save madoos-array-iterator

In your project:

const arrayIterator = require('madoos-array-iterator')

const arr = [1, 2, 3, 4, 5]
arrayIterator(arr)

while (arr.hasNext()) {
  console.log(arr.current())
  arr.next()
  // => 1
  // => 2
  // => 3
  // => 4
  // => 5
}

Funtions

  • .hasNext
  • .next
  • .prev
  • .current