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>

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    1
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i whilst

Weekly Downloads

1

Version

1.0.2

License

MIT

Last publish

Collaborators

  • teppeis