{"_id":"p-do-whilst","_rev":"8-4aca6121f1be3dc26346f39a586bf359","name":"p-do-whilst","dist-tags":{"latest":"2.1.0"},"versions":{"0.1.0":{"name":"p-do-whilst","version":"0.1.0","keywords":["promise","do","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-do-whilst@0.1.0","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/p-do-whilst#readme","bugs":{"url":"https://github.com/sindresorhus/p-do-whilst/issues"},"dist":{"shasum":"d3f209f6da3ac6e3195510c5ec3c13dfb1ddeecd","tarball":"https://registry.npmjs.org/p-do-whilst/-/p-do-whilst-0.1.0.tgz","integrity":"sha512-6Bo17ezpGDLJ6gWtgOZfGCBGjK4vfA03jCCnDo88QdiqqFuzpEwxbBsDjBZ3UHiuVDJ9/d9ZvlFT/4+OK91m9Q==","signatures":[{"sig":"MEUCIEvpfVEdZzIs8/nr7kl4+RUZ4GD1YwAFrvZ+sXt6kUVPAiEAkkTiMH+mRobkRi5B2bh48gPXKXsyFpvMyDmCRrJqSK0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","files":["index.js"],"_shasum":"d3f209f6da3ac6e3195510c5ec3c13dfb1ddeecd","engines":{"node":">=4"},"gitHead":"6f1067f8c14ad363c5e773f72f2c089755c6601d","scripts":{"test":"xo && ava"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/p-do-whilst.git","type":"git"},"_npmVersion":"3.10.10","description":"Calls a function repeatedly while a condition returns true and then resolves the promise","directories":{},"_nodeVersion":"6.11.0","devDependencies":{"xo":"*","ava":"*"},"_npmOperationalInternal":{"tmp":"tmp/p-do-whilst-0.1.0.tgz_1498848765271_0.796448532724753","host":"s3://npm-registry-packages"}},"1.0.0":{"name":"p-do-whilst","version":"1.0.0","keywords":["promise","do","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-do-whilst@1.0.0","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/p-do-whilst#readme","bugs":{"url":"https://github.com/sindresorhus/p-do-whilst/issues"},"dist":{"shasum":"add10a681f41077cb6cc2aa7e5b236f757f1fdd9","tarball":"https://registry.npmjs.org/p-do-whilst/-/p-do-whilst-1.0.0.tgz","fileCount":5,"integrity":"sha512-RgLmF1ANHx3oovAZP+BgnDt0ZmnBrusuknghNQTQ6JtL0drmykO1YASKX5CWnDQaz1OmqQCOSHKUrstjLN/OFA==","signatures":[{"sig":"MEQCIGRclJlt4Hyqvvd9vJBL8WbxmCtNmef470Rgnd23P+4AAiBsQvh0DuIkXqlMuBGPlaSQTCdAZM+6Mjf+4RoFsgnZcQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4128,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcjUUjCRA9TVsSAnZWagAAsIQP/36L46iZ0qKKItqGvIvP\nvzEz9NGaDn6ZUuqvT3HrnaXA3Jqnpe5X18UdNgOV7XSfltiIX42IlCoHhbId\niaatq52qWNWV6A8N6STeLMow9m0IvOtdVgpA1psFEGLCyCOgJ3ve4DfdBFd4\nG1SSNhJ2Nnfl8ZBx32c4OcPEqKaBoDSZy5rBdJOXM//1XCRHBDY16uVdUAbi\nsWFSxUyb9CKSSLdwvqidIwqt768bixr8YDQZ19AbTGeeCgszPFROOtzEoXM5\nkGiQK3HZO7RwU5yaNkTtTyg2h98TmEf2+9fKFTAWw1zRqNeZIs/9PNhrGrfu\nGlUcqudrjTQA9eJacVYl2oAmD4BowMiEko3+2zkz5vR0jPvyLBnGZ+yqWXlG\nfUckyDrZc0U2DFIEYkSqVFDKK9bKUDVgGpEEiOswlk1RzYwSKfSoJVOQ0F6V\nP+pbHljtPPS43oi2Av4Q+Gsw1Q2utWRZvLTiRygTT9ZYiYbOmNyzkjr24qe+\nbhBCKGoN4N/+U07jjO9CSRfebg/PHm9Xv9YqAjrH0JBWOp/4t9esLcb8yJd4\nWMx7L1dajNr4/9O/8Zslq6oi/PAG2N9tl0WUTy1yfiDuhqaA+xx0oN2xQiYv\nmcQkRjayJkY1+2yPIujL6zPwaxSQPBA8V8PhoX2T6EW30vjo3RudmWWDIRl+\nrFeJ\r\n=wTBF\r\n-----END PGP SIGNATURE-----\r\n"},"engines":{"node":">=8"},"gitHead":"61e8a86ab1716ef39c4f9e9c0ae040625c9f1ff7","scripts":{"test":"xo && ava && tsd-check"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/p-do-whilst.git","type":"git"},"_npmVersion":"6.9.0","description":"Calls a function repeatedly while a condition returns true 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-do-whilst_1.0.0_1552762146642_0.6271691664093515","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"p-do-whilst","version":"1.1.0","keywords":["promise","do","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-do-whilst@1.1.0","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/p-do-whilst#readme","bugs":{"url":"https://github.com/sindresorhus/p-do-whilst/issues"},"dist":{"shasum":"acb0305c01aa9be6c4dfe3b340221b9c57e865c8","tarball":"https://registry.npmjs.org/p-do-whilst/-/p-do-whilst-1.1.0.tgz","fileCount":5,"integrity":"sha512-ntAQbyZJAqCBoTrW3M8XEn1+45wkWgoG6EKRKGCrSvMs0wBY2a3W3mY0I5OErEweFrQsTLAhIv3KN6yyujQnzQ==","signatures":[{"sig":"MEUCIAFTvMYEkb2aZfMc4CvyQoVUa6FBcXv+B5cO3mSfBKt+AiEAyE8ysYHgCl9GBYM9jJ3fpwM5dG9aQL9yu9+J0A/OtRI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4694,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcpEG1CRA9TVsSAnZWagAA6bwQAJiX32FwTUOz5ZMI8VaK\njEQiMxcDlsi7DwKJR1O0Xov9bD9f3XloyGOp12WA8dRuaJPViBJslaAzT6mT\n8sKaXtESDkaSBIhipLv4tklgOtO8dLv3m8yV3NoYiufzL5ChMHOFYUrEoJa8\nXBJEimLZ4ejDEUCcsRT3lXH8KDXkAtVoCM0nau3fucoun7tJaO+WVu7iyA5Q\nLevsRP2r6wg16QJOQgaKHMyleXwP7/8c53sOS/yKPBXtZRhHk5gbBWs4TcDj\nabmIL6yXbj9HBfntd1E624RpTyyXFofGbS/CdNbyLRKtij9wrP/OIt7CMGAD\nzIb9w5jV4dLmUbLu5Eol2nx+j+mWXU3JKvx/+4/Ds74elPNz2WSXNMp4TRbW\nieRMlzplqhfIlUG/vmTEQMyNUpYE78J7UcafFe2hr1r5gleBzUj4MVdJAYdl\ndOTEPdltbjyUgtlSc4peCPkCM/v/9uByAG5rMgmYzOODb8vgUHKd5FD4DLhj\nmijY92IZM1c9ds/kGzZqT4Ew9zkxFOGF1RyQ6ZWl3iukXgTl4wWeKUzw84RY\nOLFJJuUw/7VdSJJuOkhCXtP4BGKiQo6lNwTuF29jCyPx4iMxGP/rDq9HiUZd\ngsTmC708YzVeGfwMRQ5KztALsoxHiU/VKCynL1asqZ5VsouaAhsk+bGoxkJA\nYGT4\r\n=3WrU\r\n-----END PGP SIGNATURE-----\r\n"},"engines":{"node":">=8"},"gitHead":"16e9cd9e877b547e3eadfe69ba19854065878b8a","scripts":{"test":"xo && ava && tsd"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/p-do-whilst.git","type":"git"},"_npmVersion":"6.9.0","description":"Calls a function repeatedly while a condition returns true 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-do-whilst_1.1.0_1554268596444_0.8674323813865474","host":"s3://npm-registry-packages"}},"2.0.0":{"name":"p-do-whilst","version":"2.0.0","keywords":["promise","do","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-do-whilst@2.0.0","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/p-do-whilst#readme","bugs":{"url":"https://github.com/sindresorhus/p-do-whilst/issues"},"dist":{"shasum":"212a8c82e66ff87351f975412b307020b5d0d70a","tarball":"https://registry.npmjs.org/p-do-whilst/-/p-do-whilst-2.0.0.tgz","fileCount":5,"integrity":"sha512-egyPJ7/c65DVu0S8UTN8EtmUsBb3L/3g5AcY3Af+ouFNkFMtwTVF2yQqZ4LjYPzz2mB5H1ytSlALR5jng/BSgg==","signatures":[{"sig":"MEYCIQDTdKYD8dODkMqcO0+SQ7e6ipK5E1qMudE4WH4ica3PBgIhAKWtqQV3W/Xz+jnRVbwNHxtbfXYFsAfZLjgx79lEXBd6","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4088,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgb+Y/CRA9TVsSAnZWagAAWxIP/1BkXCWh97o5LcLw/IQQ\nqWHN9FzXZOoyathDAF9mUW4sIY/EjTQyjKDwLzqyYItBcUHMsrBX4iPn2Yct\nTyiWLoS2lxBEeUlDMdjQtShr291ABeTOs1BxHKjZDvQYk61MtRva1z86YZmJ\n66uBG/Zkh9usy5377zQze2+RMXwj5mep220MvqW9khCrMOcADb3vFfhaPZOu\nZbZkwX2HHn6zOvIaU3nlsh0rVFcr+zwrA4wRvjp12Aw+sIfFbTDcE5jRFeio\npSMCkZRrKXckgyPPEvcR3WLd9oHgvoyUf0R0FHlaVjad8V9OO6XzH03mkq3P\n4iAQRsQcamJEyZohIMEUaaRbpwcZtj/ZVdrHUglBqBrVWWbDbF15u/HkzAQ+\nYMqxxFm3YcGIZ5gqo1njDg5RU7wskcMu6074BfEMotbI/8uugwf6Rs05ftS4\nkpk0Z+6cnqP5JbbWi58HtcR/eT9dpwvs2eVQyxRdhvNyZvAnTq3BXFig13VZ\nZ0L6wGj+J1alc/f+NgRpBEd/EIR90ah+RQjP7AQ95QRYmvA94icCmj5aEMop\nfafvGKK958xt2N86VfmRdqVt+RqliT9nB26Rvt4E/3t65wXYRiPWRHC4akT/\n3xpt+HbwACGNYqPJOji49s9KjD+w9VxHchJcxFYT4DEXn0r7TsX7JrpMjz6h\nfDCG\r\n=FwPq\r\n-----END PGP SIGNATURE-----\r\n"},"type":"module","engines":{"node":">=12"},"exports":"./index.js","funding":"https://github.com/sponsors/sindresorhus","gitHead":"d260d9f4893f969426385a7cd66d42a98e2b7b4d","scripts":{"test":"xo && ava && tsd"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/p-do-whilst.git","type":"git"},"_npmVersion":"6.14.10","description":"Calls a function repeatedly while a condition returns true 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-do-whilst_2.0.0_1617946174703_0.5362438962581846","host":"s3://npm-registry-packages"}},"2.1.0":{"name":"p-do-whilst","version":"2.1.0","description":"Calls a function repeatedly while a condition returns true and then resolves the promise","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-do-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","do","whilst","while","loop","wait","condition","conditional","async","await","promises","bluebird"],"devDependencies":{"ava":"^3.15.0","tsd":"^0.16.0","xo":"^0.38.2"},"_id":"p-do-whilst@2.1.0","gitHead":"77924b3cf093ac7ff659b17bd09f5e1049e2f76d","bugs":{"url":"https://github.com/sindresorhus/p-do-whilst/issues"},"homepage":"https://github.com/sindresorhus/p-do-whilst#readme","_nodeVersion":"18.20.4","_npmVersion":"10.6.0","dist":{"integrity":"sha512-g7yyqXQmjXQ0qx6Khm5jrN5wAJKLr0UGaFNPNKUUcf98XjLwOHqHt3RoURw3NcxhTpuke3Z7NZSaT+mQg/ukqQ==","shasum":"8295d21e65c83356dd4f620974037c0afce0c7d9","tarball":"https://registry.npmjs.org/p-do-whilst/-/p-do-whilst-2.1.0.tgz","fileCount":5,"unpackedSize":4978,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICIilRRXQ4wIs5wUCI9OB5Psc6R5ZlPvMpKgu90dSMp8AiEA9aQw9zqGXgk3JoTHpUFNTWEeIMts28AYrqgEycM7h90="}]},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-do-whilst_2.1.0_1724947812089_0.7022862842679884"},"_hasShrinkwrap":false}},"time":{"created":"2017-06-30T18:52:46.226Z","modified":"2024-08-29T16:10:12.431Z","0.1.0":"2017-06-30T18:52:46.226Z","1.0.0":"2019-03-16T18:49:06.774Z","1.1.0":"2019-04-03T05:16:36.706Z","2.0.0":"2021-04-09T05:29:34.824Z","2.1.0":"2024-08-29T16:10:12.247Z"},"bugs":{"url":"https://github.com/sindresorhus/p-do-whilst/issues"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"license":"MIT","homepage":"https://github.com/sindresorhus/p-do-whilst#readme","keywords":["promise","do","whilst","while","loop","wait","condition","conditional","async","await","promises","bluebird"],"repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-do-whilst.git"},"description":"Calls a function repeatedly while a condition returns true and then resolves the promise","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"readme":"# p-do-whilst\n\n> Calls a function repeatedly while a condition returns true and then resolves the promise\n\nThink async version of the [`do…while` statement](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/do...while).\n\n## Install\n\n```sh\nnpm install p-do-whilst\n```\n\n## Usage\n\nChoose your preferred style:\n\n```js\nimport pDoWhilst from 'p-do-whilst';\n\nlet count = 0;\n\nawait pDoWhilst(\n\t() => count++,\n\t() => count < 5\n);\n\nconsole.log(count);\n//=> 5\n```\n\nOr:\n\n```js\nimport pDoWhilst from 'p-do-whilst';\n\nconst count = await pDoWhilst(\n\tcurrentCount => currentCount + 1,\n\tcurrentCount => currentCount < 5,\n\t0\n);\n\nconsole.log(count);\n//=> 5\n```\n\n## API\n\n### pDoWhilst(action, condition, initialValue?)\n\nExecutes `action` repeatedly while `condition` returns `true` and then resolves 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#### action\n\nType: `Function`\\\nArguments: The value the last call to `action` function returns or `initialValue` for the first iteration.\n\nAction to run for each iteration.\n\nYou can return a promise and it will be handled.\n\n#### condition\n\nType: `Function`\\\nArguments: The value the `action` function returns.\n\nExpected to return a `boolean` or a `Promise<boolean>` of whether to continue.\n\n## Related\n\n- [p-whilst](https://github.com/sindresorhus/p-whilst) - While a condition returns true, calls a function repeatedly, 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":{"flumpus-dev":true}}