@amphibian/iterate-up

2.0.2 • Public • Published

iterate-up

build status

while loop abstraction for iterating up with +1 as increment

npm install @amphibian/iterate-up
var iterateUp = require('@amphibian/iterate-up');

// Iterate 5 times
iterateUp(5, function (i) {
    console.log(i); // 0, 1, 2, 3, 4
});

// Iterate 5 times, but stop at 3
var question = iterateUp(5, function (i, end) {
    if (i === 3) {
        end('hola que tal');
    }

    console.log(i); // 0, 1, 2, 3
});

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

Readme

Keywords

none

Package Sidebar

Install

npm i @amphibian/iterate-up

Weekly Downloads

14

Version

2.0.2

License

ISC

Last publish

Collaborators

  • thomaslindstr_m