whilst

1.0.2 • Public • Published

whilst

While loop for async function with Promise

NPM version Node.js Version Support build status Dependency Status MIT License

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 <teppeis@gmail.com>

Readme

Keywords

Package Sidebar

Install

npm i whilst

Weekly Downloads

1

Version

1.0.2

License

MIT

Last publish

Collaborators

  • teppeis