whilst
v1.0.2
Published
While loop for async function with Promise
Downloads
6
Readme
whilst
While loop for async function with Promise
Install
$ npm install whilst
Usage
let result = [];
let i = 0;
whilst(() => i < 3, () => {
result.push(i);
return Promise.resolve(i++);
}).then(finalResult => {
assert.deepEqual(result, [0, 1, 2]);
assert.equal(finalResult, 2);
});
License
MIT License: Teppei Sato <[email protected]>