@amphibian/iterate-up-array

1.0.1 • Public • Published

iterate-up-array

build status

while loop abstraction for looping up through indices from 0 to Array.length

npm install @amphibian/iterate-up-array
var iterateUpArray = require('@amphibian/iterate-up-array');
var array = ['zero', 'one', 'two'];

// Iterate from the first index to the last
iterateUpArray(array, function (index, i) {
    console.log(index, i); // zero 0, one 1, two 2
});

// Iterate from the first index to the last, but stop if the key is `one`
var question = iterateUpArray(array, function (index, i, end) {
    console.log(index, i); // zero 0, one 1

    if (index === 'one') {
        end('hola que hora es');
    }
});

console.log(question); // > hola que hora es

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    90
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    90
  • 1.0.0
    1

Package Sidebar

Install

npm i @amphibian/iterate-up-array

Weekly Downloads

2

Version

1.0.1

License

ISC

Last publish

Collaborators

  • thomaslindstr_m