{"_id":"p-whilst","_rev":"10-45c256a8b52ea9153e1e6989c2e36607","name":"p-whilst","dist-tags":{"latest":"3.2.0"},"versions":{"1.0.0":{"name":"p-whilst","version":"1.0.0","keywords":["promise","whilst","while","loop","wait","condition","conditional","async","await","promises","bluebird"],"author":{"url":"sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"p-whilst@1.0.0","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/p-whilst#readme","bugs":{"url":"https://github.com/sindresorhus/p-whilst/issues"},"xo":{"esnext":true},"dist":{"shasum":"54668ead7f934799fc00f1e5230fd6addeb8e7e6","tarball":"https://registry.npmjs.org/p-whilst/-/p-whilst-1.0.0.tgz","integrity":"sha512-Kyi4e1MPJk2YW0f8UCAesmqpnuP7YDsoIyapur+Zxf2k8KJ0e4Bsot6Nqdzr6ZPV7BUy5xzrGm64JcXRU4ugxw==","signatures":[{"sig":"MEQCIBUf36HgDjpSK9C9caFlO9SmDfeXxZcVGfB9H/WSyaYuAiBuV2uAZCg6bypvM5snElM60bTRySShGVsHvdlm65Ry5g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","files":["index.js"],"_shasum":"54668ead7f934799fc00f1e5230fd6addeb8e7e6","engines":{"node":">=4"},"gitHead":"97c14586491eee70290d461e115da2dbb1c6a6a4","scripts":{"test":"xo && ava"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/p-whilst.git","type":"git"},"_npmVersion":"2.15.9","description":"Calls a function repeatedly while a condition returns true and then resolves the promise","directories":{},"_nodeVersion":"4.6.0","devDependencies":{"xo":"*","ava":"*"},"_npmOperationalInternal":{"tmp":"tmp/p-whilst-1.0.0.tgz_1477039287508_0.6049056644551456","host":"packages-12-west.internal.npmjs.com"}},"2.0.0":{"name":"p-whilst","version":"2.0.0","keywords":["promise","whilst","while","loop","wait","condition","conditional","async","await","promises","bluebird"],"author":{"url":"sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"p-whilst@2.0.0","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/p-whilst#readme","bugs":{"url":"https://github.com/sindresorhus/p-whilst/issues"},"dist":{"shasum":"aa3cf8af7cf7d54e1025ad2f9f3f6caca34edd0f","tarball":"https://registry.npmjs.org/p-whilst/-/p-whilst-2.0.0.tgz","fileCount":5,"integrity":"sha512-vlz6N3zzlFXm8KHUxKTLNfQVBkEYFXn7dnGb770qKa1lG8O+2SOL5K75zxP7lkDHbbQNO67QotdH7WKmZPYAug==","signatures":[{"sig":"MEUCIAgxv2uOuyXZxwOjYzFsRayvoMCRm9ZAUs+E3zLNfcHEAiEA00y1fLnZNjSpUwcBOUQpb1I+DPmRR9SPLpSDxIHmX0U=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4185,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcjUObCRA9TVsSAnZWagAAIwcP/22pSeoN0wSYZLK5MTza\njb1okTOvJvzIC4XkiQxMD1XgFXiCpyYIAiQA/9dKxFrO7MHQwrYhwYg2/PSl\nCjKwKtD7iUpoPi5aokmC5genXQem3V2Lb4zXqkxm9P5HWSCQPVlsS+XJFqQx\n9Irgf7MjEbDRp/tZKy7wGlbvg+3ltj+vgB559dNGS+lI7dfuX7/ZvRI8Tfiz\nvNCcmXAzkDDK5ICNRbfar+SdMuzNztS9Oep4laBEgk7V32wgm4ommUUmQUsq\nhWHM9RTA2IyQVHbL4aTD4M5wzg0EoWR9Fu8Y6txAIQKm7pXftmY2A1MjYwBt\njCHyibIgEB/7XYQdsk7+558iFnTS9vwwDzUtK4rfEk4NmjtUuKxGgxUzz2LP\nfE+EON0Vx3QNrxwgW4QPf3VstPGDfRP/T8kATvecrLgRNhMiwucZvsPXZjJO\njzP/uwolqwarrEnMs1Jh0thgY93splmdKQrM6vL93vE5pM2R8+S+fQ6bv/ta\ndaJ5JrVMk1b+ZIzDuIY5ze9cYYtN8hdEj4vOY7YE+XDjvCcqCA5eYbl8ThY5\n/LIg2NYiz0+KNO29n3OIJ+J1DBzhhg1H5tJxQ2NWmaGPPVXs/Nvk4fwRKygq\nxy4cjplvZCizSDL7/m2CgJKq3TQiLP2MT2c9FQ/ghDoYSPVGNZfJ0dOKErOu\ncM9T\r\n=er1V\r\n-----END PGP SIGNATURE-----\r\n"},"engines":{"node":">=8"},"gitHead":"7f644a9ea1a5a53548422a0ecccf77d8be4549bc","scripts":{"test":"xo && ava && tsd-check"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/p-whilst.git","type":"git"},"_npmVersion":"6.9.0","description":"While a condition returns true, calls a function repeatedly, and then resolves the promise","directories":{},"_nodeVersion":"8.15.0","_hasShrinkwrap":false,"devDependencies":{"xo":"^0.24.0","ava":"^1.3.1","tsd-check":"^0.4.0"},"_npmOperationalInternal":{"tmp":"tmp/p-whilst_2.0.0_1552761755264_0.13454196038458566","host":"s3://npm-registry-packages"}},"2.1.0":{"name":"p-whilst","version":"2.1.0","keywords":["promise","whilst","while","loop","wait","condition","conditional","async","await","promises","bluebird"],"author":{"url":"sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"p-whilst@2.1.0","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/p-whilst#readme","bugs":{"url":"https://github.com/sindresorhus/p-whilst/issues"},"dist":{"shasum":"d8f3aa3a68f5595ab8b40a62cc3d49d8f9cf082c","tarball":"https://registry.npmjs.org/p-whilst/-/p-whilst-2.1.0.tgz","fileCount":5,"integrity":"sha512-uzp1HPgqzokEmZN+VpfQ9PO4YY5xm+jpLJeL9FN1NPU4d4IZh8eEV+mtQXd+/22R1P7C5j19b7Y//oUc7k0+RQ==","signatures":[{"sig":"MEYCIQDLz5AKRk6LQJkMUrt0SA19n9TwjVXetNeGii7IZFd23gIhAOUqE/joalHRmXle+EOa3k6gPFgBtP1cGe+qnClqpYx/","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4748,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcpEBSCRA9TVsSAnZWagAAhrAP/1eEruqGVhehHLl6u0dW\n/UME5UQapacXEwMA+uQam0L92u2mLvkgfIeCYmB086oLTWWmGRqM3WiQmvHv\ngppU+qHu5YnFhelWh5VE+6C30jtefo1lAfmOmjl+O9MvYbr8V9Oi2CUCOzey\n0wWRxzG8gyHv4SH2zSqqH7MRc0f8O/fBxcUI/Dk6IaziiY9uPlT8fNGTBRWA\nr7yVeK3e16Hfu1BP5MPIpL8+TKw++dwIe50jxKxppWsyp5W88gfXY3D1ZoGe\nXj7IX/55ABxcP3u/iCNR/gtpJSusMMyej8x992pfDdrY2MR38sVA7Mp1GMZf\nXiGBZ3RmgcyU/Lz5ITlkrHus+lXga3meyEo8b8b0+lpII+4bWdx5oMSi2ks0\nAYLcHG3WexRsVIc4ETH8yrCivfqN/02/qzeKlBgKW0xGcrjSQK7yzZHtWzvW\nHyVqtxrdWG6B6o+iPhD2kwqb7OfMzodNt5RXnhuLqSf6owTSNPzSUOZoRI59\nsSzmdp8DnSOMLK/pwDyNMVrKq1lpGDIKFsGEL9F/D6i9VXYzfifyuZS8KOkA\n5rJI9LaJ1vatA2tgkMbSNBGe3K5fRbjD/3n1G7M+rQj5IkLBD1rcfiXF4Qfb\na6jJLOedY3GrUg/+xezfvJhDxGDBmxMc2E49y6QI90ysQOCzNTJV9T2bQy7M\nsnRE\r\n=RLpj\r\n-----END PGP SIGNATURE-----\r\n"},"engines":{"node":">=8"},"gitHead":"11b68bf90028649191c5d4fd9051ab6529d427df","scripts":{"test":"xo && ava && tsd"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/p-whilst.git","type":"git"},"_npmVersion":"6.9.0","description":"While a condition returns true, calls a function repeatedly, and then resolves the promise","directories":{},"_nodeVersion":"8.15.0","_hasShrinkwrap":false,"devDependencies":{"xo":"^0.24.0","ava":"^1.4.1","tsd":"^0.7.2"},"_npmOperationalInternal":{"tmp":"tmp/p-whilst_2.1.0_1554268242199_0.5750616864837486","host":"s3://npm-registry-packages"}},"3.0.0":{"name":"p-whilst","version":"3.0.0","keywords":["promise","whilst","while","loop","wait","condition","conditional","async","await","promises","bluebird"],"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"p-whilst@3.0.0","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/p-whilst#readme","bugs":{"url":"https://github.com/sindresorhus/p-whilst/issues"},"dist":{"shasum":"8adce253272da6e68bddf163815d2233098805cb","tarball":"https://registry.npmjs.org/p-whilst/-/p-whilst-3.0.0.tgz","fileCount":5,"integrity":"sha512-vaiNNmeIUGtMzf121RTb3CCC0Nl4WNeHjbmPjRcwPo6vQiHEJRpHbeOcyLBZspuyz2yG+G2xwzVIiULd1Mk6MA==","signatures":[{"sig":"MEYCIQDkMtZgKbPqfGZApu4xhiXHRGjy3tluFMXse6XrJrBV1QIhAMSqFKPLCgR5TEKT1zazSnXsxXeeYdSLZLmJmObX/9yD","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4145,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgcAWnCRA9TVsSAnZWagAAiqsP/RwVVVdcy8vRNPT60PRd\nuQ1PqAeuzK5ipkL9HUVPHkDJYUR9k1lDal7A4ZliWKRUTzkRAVlCuBrklaop\n9YgmGqs78XRxbdOcvIGBOaz/r/cqV76d+rk5ZTkfoZX2/LalsJbEhzYnmA8B\npYueIGrxg40X0cNQqHsqeku8eL5U7/SBx5LRWq8I30b/cUO76upZnTlNwdLJ\nkuYOeyhSbiWhmO3lozC7X4td7Lr25ao2ar4Ay1fYjD3Invr457+Ru82GnNxj\nLz7TqWBUi931BjOsSuYJMdy3j5lWRX3FQuEsCYJzqmTe03SEhfJv4Oa0y/5a\ncP1d2kss83vEGrJZhuOuyckTEiDJaUgRSQs45HrkM6r1TXV2fMLEZTlxZqzM\nAkEnd4loLvb9K17ZV9qUYGKPyWXE9aSZzuhwImSO6KNTrjO4iIGK7DRrRytG\nJeSZzMKBxmvejjsu9/eUQ+VGjqeefmz+oT+hldErFVfUeE7/Vd/axRg9GLSc\nWgLr1k9+rxHfmpcx77XbPjXFPYrX4MBdcZcWRRqBa7r9MTfVly/qKsyirvm/\n8lQI/K89IEcjWNlS6fSVASpo17/W5zrfdvk9P+NromUl85pumoMnAK6At1oN\nrVjayeRMGu/mCMfVhTjFoQ/XwifjBrzEECK4vuGVrda93zz7D/pxCcxkpaJH\nHxv6\r\n=SlrX\r\n-----END PGP SIGNATURE-----\r\n"},"type":"module","engines":{"node":">=12"},"exports":"./index.js","funding":"https://github.com/sponsors/sindresorhus","gitHead":"d00d61e42090be4394410e2aae557ca6925d888c","scripts":{"test":"xo && ava && tsd"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/p-whilst.git","type":"git"},"_npmVersion":"6.14.10","description":"While a condition returns true, calls a function repeatedly, and then resolves the promise","directories":{},"_nodeVersion":"15.12.0","_hasShrinkwrap":false,"devDependencies":{"xo":"^0.38.2","ava":"^3.15.0","tsd":"^0.14.0"},"_npmOperationalInternal":{"tmp":"tmp/p-whilst_3.0.0_1617954214569_0.5187710089918627","host":"s3://npm-registry-packages"}},"3.1.0":{"name":"p-whilst","version":"3.1.0","keywords":["promise","whilst","while","loop","wait","condition","conditional","async","await","promises","bluebird"],"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"p-whilst@3.1.0","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/p-whilst#readme","bugs":{"url":"https://github.com/sindresorhus/p-whilst/issues"},"dist":{"shasum":"350187e00981db21f0383551b705ce16d1bd65a0","tarball":"https://registry.npmjs.org/p-whilst/-/p-whilst-3.1.0.tgz","fileCount":5,"integrity":"sha512-GA8P2NTp45JQ4gw6w9J4bb6LSpLw+rItJTXzDjJxw4G7rzS2CiQZijZKV64YYrn5vkRE0Q307Q8cHWZt07LNDw==","signatures":[{"sig":"MEUCIQC3lFSXHB7xey1pQ3PYlDroag/wwW4qfjoxEn27Ts+eagIgUKSvuofrA5Eyymlyr+Je8gMpFlLExSQrhWoS/ysJRa4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4249},"type":"module","types":"./index.d.ts","engines":{"node":">=12"},"exports":"./index.js","funding":"https://github.com/sponsors/sindresorhus","gitHead":"8d1b7e6aedc7cc7b32e45a52c5d313d25bfe5f8a","scripts":{"test":"xo && ava && tsd"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/p-whilst.git","type":"git"},"_npmVersion":"9.2.0","description":"While a condition returns true, calls a function repeatedly, and then resolves the promise","directories":{},"_nodeVersion":"16.20.0","_hasShrinkwrap":false,"devDependencies":{"xo":"^0.55.0","ava":"^5.3.1","tsd":"^0.28.1"},"_npmOperationalInternal":{"tmp":"tmp/p-whilst_3.1.0_1689967280918_0.7350292685465962","host":"s3://npm-registry-packages"}},"3.2.0":{"name":"p-whilst","version":"3.2.0","description":"While a condition returns true, calls a function repeatedly, and then resolves the promise","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-whilst.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","types":"./index.d.ts","sideEffects":false,"engines":{"node":">=12"},"scripts":{"test":"xo && ava && tsd"},"keywords":["promise","whilst","while","loop","wait","condition","conditional","async","await","promises","bluebird"],"devDependencies":{"ava":"^5.3.1","tsd":"^0.28.1","xo":"^0.55.0"},"_id":"p-whilst@3.2.0","gitHead":"a270bac9389a1738beff9c5279097617af750cd4","bugs":{"url":"https://github.com/sindresorhus/p-whilst/issues"},"homepage":"https://github.com/sindresorhus/p-whilst#readme","_nodeVersion":"22.6.0","_npmVersion":"10.6.0","dist":{"integrity":"sha512-eqUz0XGVIwDDP2XZ2wg2nmi2a6pH3XJeub0z9l31OVnXCkyF+shVRe6qp8dJ85w7T5qJrfmIKAGbcdruDQQxMw==","shasum":"eee6bf8fbcefa10659f95ec52d8a45b6cf644207","tarball":"https://registry.npmjs.org/p-whilst/-/p-whilst-3.2.0.tgz","fileCount":5,"unpackedSize":4617,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHQKm+lSkWA32ZxX6CzEdtl+neahPwYCp3ekQTqazZA2AiAEgKJ45DJj1aGGtWZv2Rk4/q4uAhaxnl64jkjqeu2+/Q=="}]},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-whilst_3.2.0_1729089556745_0.8859506554858414"},"_hasShrinkwrap":false}},"time":{"created":"2016-10-21T08:41:27.726Z","modified":"2024-10-16T14:39:17.106Z","1.0.0":"2016-10-21T08:41:27.726Z","2.0.0":"2019-03-16T18:42:35.416Z","2.1.0":"2019-04-03T05:10:42.286Z","3.0.0":"2021-04-09T07:43:34.976Z","3.1.0":"2023-07-21T19:21:21.095Z","3.2.0":"2024-10-16T14:39:16.928Z"},"bugs":{"url":"https://github.com/sindresorhus/p-whilst/issues"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"license":"MIT","homepage":"https://github.com/sindresorhus/p-whilst#readme","keywords":["promise","whilst","while","loop","wait","condition","conditional","async","await","promises","bluebird"],"repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-whilst.git"},"description":"While a condition returns true, calls a function repeatedly, and then resolves the promise","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"readme":"# p-whilst\n\n> While a condition returns true, calls a function repeatedly, and then resolves the promise\n\nThink async version of the [`while` statement](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/while).\n\n## Install\n\n```sh\nnpm install p-whilst\n```\n\n## Usage\n\n```js\nimport pWhilst from 'p-whilst';\n\nlet count = 0;\n\nawait pWhilst(\n\t() => count < 5,\n\t() => count++\n);\n\nconsole.log(count);\n//=> 5\n```\n\n## API\n\n### pWhilst(condition, action, initialValue?)\n\nWhile `condition` returns `true`, executes `action` repeatedly, and then resolves the promise to the result of the last call to `action`. Rejects if `action` returns a promise that rejects or if an error is thrown anywhere.\n\n#### condition\n\nType: `Function`\nArguments: The value the `action` function returns or `initialValue` for the first iteration.\n\nExpected to return a `boolean` or a `Promise<boolean>` that indicates whether to execute `action`.\n\n#### action\n\nType: `Function`\nArguments: The value the last call to `action` function returns.\n\nAction to run for each iteration.\n\nYou can return a promise and it will be handled.\n\n## Related\n\n- [p-do-whilst](https://github.com/sindresorhus/p-do-whilst) - Calls a function repeatedly while a condition returns true and then resolves the promise\n- [p-forever](https://github.com/sindresorhus/p-forever) - Run promise-returning & async functions repeatedly until you end it\n- [p-wait-for](https://github.com/sindresorhus/p-wait-for) - Wait for a condition to be true\n- [More…](https://github.com/sindresorhus/promise-fun)\n","readmeFilename":"readme.md","users":{"rocket0191":true}}