@amphibian/iterate-up
v2.0.2
Published
while loop abstraction for iterating up with +1 as increment
Downloads
31
Readme
iterate-up
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