promise-loop
Loop for asynchronous javascript
Installation
$ npm install promise-loop
Usage
var promiseLoop = ; //Create our promise to Loopvar { return { console; if value < 10 ; else console; ; };}; //prepare to loopvar myPromiseLoop = ; //And now, just run it with the correct valuevar promise = ;//received value: 0// resolving//received value: 1// resolving//received value: 2// resolving//received value: 3// resolving//received value: 4// resolving//received value: 5// resolving//received value: 6// resolving//received value: 7// resolving//received value: 8// resolving//received value: 9// resolving//received value: 10// rejecting //We can use it with other promises//Create a simples Promisesvar { return { console; ; };}; var { console; return value;}; //Run normally againvar promise = ;//Starting with value 0//received value: 0// resolving//...//received value: 10// rejecting//Ending with value false //By default, in promiseLoop, we are using a rejectPromise//that only pass the value forward, but you can handle it diferent.//And you have a catchRejectPromise already there to help you//changing our previous loopingPromise:var { return { console; if value < 10 ; else console; ; };}; //And create a function to handle the catchvar { console;}; //prepare again our loopingPromisevar myPromiseLoopWithProblems = ; //Run it with catchvar promise = ;//And now we will have this://Starting with value 0//received value: 0// resolving//...//received value: 10// rejecting//Ending with value false////Or this://Starting with value 0//received value: 0// resolving//...//received value: 10// rejecting//alert, something is wrong!