{"_id":"promise-do-whilst","_rev":"359096","name":"promise-do-whilst","description":"Calls a function repeatedly while a condition returns true and then resolves the promise","dist-tags":{"latest":"1.0.1"},"maintainers":[{"name":"buster","email":"busterc@gmail.com"}],"time":{"modified":"2021-07-13T08:44:29.000Z","created":"2015-11-25T22:25:53.489Z","1.0.1":"2016-05-23T17:45:05.843Z","1.0.0":"2015-11-25T22:25:53.489Z"},"users":{},"author":{"name":"Buster Collings","email":"busterc@gmail.com","url":"https://about.me/buster"},"repository":{"type":"git","url":"git+https://github.com/busterc/promise-do-whilst.git"},"versions":{"1.0.1":{"name":"promise-do-whilst","version":"1.0.1","description":"Calls a function repeatedly while a condition returns true and then resolves the promise","author":{"name":"Buster Collings","email":"busterc@gmail.com","url":"https://about.me/buster"},"files":["dist"],"main":"dist/index.js","keywords":["contional","condition","wait","loop","while","whilst","dowhilst","promisedowhilst","promises","promise","until","dountil","promisedountil","do","dowhile"],"repository":{"type":"git","url":"git+https://github.com/busterc/promise-do-whilst.git"},"devDependencies":{"gulp":"^3.6.0","gulp-eslint":"^1.0.0","gulp-exclude-gitignore":"^1.0.0","gulp-istanbul":"^0.9.0","gulp-mocha":"^2.0.0","gulp-plumber":"^1.0.0","gulp-nsp":"^2.1.0","gulp-babel":"^5.1.0","del":"^2.0.2","babel-core":"^5.5.0","isparta":"^3.0.3"},"scripts":{"prepublish":"gulp prepublish","test":"gulp"},"license":"ISC","gitHead":"bf943eac1c562c8237efd2f943cf3f396628a260","bugs":{"url":"https://github.com/busterc/promise-do-whilst/issues"},"homepage":"https://github.com/busterc/promise-do-whilst#readme","_id":"promise-do-whilst@1.0.1","_shasum":"6ddad44009f36da9549dbdccfad99a868dff9ecf","_from":".","_npmVersion":"3.8.2","_nodeVersion":"4.4.3","_npmUser":{"name":"buster","email":"busterc@gmail.com"},"dist":{"shasum":"6ddad44009f36da9549dbdccfad99a868dff9ecf","size":1922,"noattachment":false,"key":"/promise-do-whilst/-/promise-do-whilst-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/promise-do-whilst/download/promise-do-whilst-1.0.1.tgz"},"maintainers":[{"name":"buster","email":"busterc@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/promise-do-whilst-1.0.1.tgz_1464025503390_0.08849662356078625"},"directories":{},"publish_time":1464025505843,"_cnpm_publish_time":1464025505843,"_hasShrinkwrap":false},"1.0.0":{"name":"promise-do-whilst","version":"1.0.0","description":"Calls a function repeatedly while a condition returns true and then resolves the promise","author":{"name":"Buster Collings","email":"busterc@gmail.com","url":"https://about.me/buster"},"files":["dist"],"main":"dist/index.js","keywords":["contional","condition","wait","loop","while","whilst","dowhilst","promisedowhilst","promises","promise","until","dountil","promisedountil","do","dowhile"],"repository":{"type":"git","url":"git+https://github.com/busterc/promise-do-whilst.git"},"devDependencies":{"gulp":"^3.6.0","gulp-eslint":"^1.0.0","gulp-exclude-gitignore":"^1.0.0","gulp-istanbul":"^0.9.0","gulp-mocha":"^2.0.0","gulp-plumber":"^1.0.0","gulp-nsp":"^2.1.0","gulp-babel":"^5.1.0","del":"^2.0.2","babel-core":"^5.5.0","isparta":"^3.0.3"},"scripts":{"prepublish":"gulp prepublish","test":"gulp"},"license":"ISC","gitHead":"aa77d3eee55b97da10865e1e776f50efb11b2418","bugs":{"url":"https://github.com/busterc/promise-do-whilst/issues"},"homepage":"https://github.com/busterc/promise-do-whilst#readme","_id":"promise-do-whilst@1.0.0","_shasum":"1695ec9ac4e61d1df3f84a744173253bb3a27c78","_from":".","_npmVersion":"2.13.2","_nodeVersion":"0.12.7","_npmUser":{"name":"buster","email":"busterc@gmail.com"},"dist":{"shasum":"1695ec9ac4e61d1df3f84a744173253bb3a27c78","size":1901,"noattachment":false,"key":"/promise-do-whilst/-/promise-do-whilst-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/promise-do-whilst/download/promise-do-whilst-1.0.0.tgz"},"maintainers":[{"name":"buster","email":"busterc@gmail.com"}],"directories":{},"publish_time":1448490353489,"_cnpm_publish_time":1448490353489,"_hasShrinkwrap":false}},"readme":"# promise-do-whilst [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url]\n> Calls a function repeatedly while a condition returns true and then resolves the promise\n\n- See Also\n  - [promise-whilst](https://github.com/sindresorhus/promise-whilst)\n  - [promise-until](https://github.com/busterc/promise-until)\n  - [promise-do-until](https://github.com/busterc/promise-do-until)\n\n## Installation\n\n```sh\n$ npm install --save promise-do-whilst\n```\n\n## Usage\n\n```js\nimport promiseDoWhilst from 'promise-do-whilst';\n\nlet count = 0;\n\npromiseDoWhilst(() => {\n  count++;\n}, () => {\n  return count < 5;\n}).then(() => {\n  console.log(count);\n  // => 5\n});\n\n// ...\n\nlet max = 0;\n\npromiseDoWhilst(() => {\n  max++;\n}, () => {\n  return max < 1;\n}).then(() => {\n  console.log(max);\n  // => 1\n});\n\n```\n\n## API\n\n### promiseDoWhilst(action, condition)\n\nExecutes `action` repeatedly while `condition` returns `true` and then resolves the promise. Rejects if `action` returns a promise that rejects or if an error is thrown anywhere.\n\n#### action\n\nType: `function`\n\nAction to run for each iteration.\n\nYou can return a promise and it will be handled.\n\n#### condition\n\nType: `function`\n\nShould return a boolean of whether to continue.\n\n## License\n\nISC © [Buster Collings]()\n\n\n[npm-image]: https://badge.fury.io/js/promise-do-whilst.svg\n[npm-url]: https://npmjs.org/package/promise-do-whilst\n[travis-image]: https://travis-ci.org/busterc/promise-do-whilst.svg?branch=master\n[travis-url]: https://travis-ci.org/busterc/promise-do-whilst\n[daviddm-image]: https://david-dm.org/busterc/promise-do-whilst.svg?theme=shields.io\n[daviddm-url]: https://david-dm.org/busterc/promise-do-whilst\n","_attachments":{},"homepage":"https://github.com/busterc/promise-do-whilst#readme","bugs":{"url":"https://github.com/busterc/promise-do-whilst/issues"},"license":"ISC"}