@amphibian/iterate-down

while loop abstraction for iterating down with -1 as increment

Stats

StarsIssuesVersionUpdatedCreatedSize
@amphibian/iterate-down
2.0.25 years ago6 years agoMinified + gzip package size for @amphibian/iterate-down in KB

Readme

iterate-down

build status

while loop abstraction for iterating down with -1 as increment

npm install @amphibian/iterate-down
var iterateDown = require('@amphibian/iterate-down');

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

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

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

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

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.