{"name":"@iocmd/hold-up","version":"2.0.0","type":"commonjs","author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"description":"setInterval with promises, counter and error handling","homepage":"http://github.com/iocmd/hold-up","main":"lib/hold-up.js","repository":{"type":"git","url":"git://github.com/iocmd/hold-up.git"},"keywords":["timeout","interval","promise","async","await","try-catch","try"],"scripts":{"test":"madrun test","coverage":"madrun coverage","lint":"madrun lint","fix:lint":"madrun fix:lint","report":"madrun report","watcher":"madrun watcher","watch:test":"madrun watch:test","watch:lint":"madrun watch:lint","watch:tape":"madrun watch:tape","watch:coverage:base":"madrun watch:coverage:base","watch:coverage:tape":"madrun watch:coverage:tape","watch:coverage":"madrun watch:coverage"},"dependencies":{"try-to-catch":"^3.0.0"},"license":"MIT","devDependencies":{"@cloudcmd/stub":"^3.7.1","eslint":"^8.12.0","eslint-plugin-node":"^11.0.0","eslint-plugin-putout":"^14.7.1","madrun":"^9.0.2","nodemon":"^2.0.2","nyc":"^15.0.0","putout":"^25.14.0","supertape":"^7.2.1"},"engines":{"node":">=16"},"publishConfig":{"access":"public"},"gitHead":"5bcb159fa8a9704065c72ff43d83317b15ac1028","bugs":{"url":"https://github.com/iocmd/hold-up/issues"},"_id":"@iocmd/hold-up@2.0.0","_nodeVersion":"16.14.2","_npmVersion":"8.3.0","dist":{"integrity":"sha512-aF1MB7aJbL3wCAyuPQ6oBm6O/adv6vcPTqUusvC8eZnbJBzPD78VSTq9hBZGXKthXNECdd4IdrVEJinqNvrtPw==","shasum":"61aa3f798f0b16eff1782233aec7b0a026b1b1c1","tarball":"http://registry-npm.ywwl.com/@iocmd/hold-up/download/@iocmd/hold-up-2.0.0.tgz","fileCount":5,"unpackedSize":6942,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIArjjRQjMKh9uxm3/mhw8c4pbT6qmNgX38E03HCHKIDaAiB2ku0QpkrJJ5qA4eFuhpzRk7zu9av6hJZvEplARH+vQQ=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiTeVCACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrI2g/6ArYC3qwPPpANntFKys4cWM7Q+EvqLwHqrBkvFKlVJ+mljSWX\r\nDTh7Gz+1hJ5epvhTa8wmGv6vM6AitJClfA7yIxnqOi8mYxEt6ozek8s/WRvk\r\nKR/18ctgbaSBmGPrXQLPKR5Pc+AXtdjr29hXh7rnnX/2n/lXSbI4ZxVgsIkC\r\nod/F6hByV1Eg8v7tOXzUbI46s13vuKzCpeZNkzOvFQaLh6+OORqHjFCVmFps\r\nuvXGIB8TjyWFZvTWT6W3WFbqBeGhTtGdRsDxeD9X+8zUZrf2lKDT9ViO5G0S\r\nxy+kW+ZLO6Z4F5+NftZ9F+qA4CGAhcNj0ouJGYvR6LR6L164zWdaBBAwFLkt\r\n40P1igWuwhrw3GtDkY+gL94qPqjdToQ1dRx3y786Z506zBRcX+XLRNmNlM/b\r\nUk266Oh2HAMdQ7xgEiocBylATqPhqysoub34P//4/r2tjM+foHK2pmBq4D/N\r\nF1zo6zi6GL8XWz8k9pCO+g1gLh+HnCrxYq7FR1e/ltV2/yHpcewHI8LeH++I\r\nDzsgOEK0zAPg1KM2VXFLub+xKqmU5C9NIVRAEM+EuKBUGqD6yqntQRbu88KU\r\np8cTEubXs1aNPpjOzfwlgQmscSP/RpxHRpTrdRg/NgBR492uqIDrAiP2X4FV\r\nsgxLnHj4F9bNBe2Nian3vAi2X5Kk+/hxIgo=\r\n=/6Rj\r\n-----END PGP SIGNATURE-----\r\n","size":2990,"noattachment":false,"key":"/@iocmd/hold-up/-/@iocmd/hold-up-2.0.0.tgz"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"directories":{},"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hold-up_2.0.0_1649272130036_0.2279070308335256"},"_hasShrinkwrap":false,"readme":"# Hold Up [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]\n\n`hold up` is `setInterval` with `promises`, `counter` and `error handling`.\nIt runs a `function` and if it `throws` run it again with interval (defaults to 1 second) `counter` times (defaults to 5). If it fails, promise throws, if successed resolves.\n\n## Install\n\n`npm i @iocmd/hold-up --save`\n\n## API\n\n### holdUp(fn[, options])\n\n### holdUp([fn, args], options)\n\n- `fn` - function\n- `args` - array of arguments\n- `options` - options may contain:\n  - `log`\n  - `count`\n  - `time`\n\n```js\nconst holdUp = require('hold-up');\nconst fn = async (a = 'hello') => {\n    throw Error(a);\n};\n\nawait holdUp(fn);\n\n// reject in a 5 seconds\n// [Error: hello]\n\n// with arguments\nawait holdUp([fn, 'world']);\n\n// reject in a 5 seconds\n//[Error: hello]\n\n// when you need to override options,\nawait holdUp([fn, 'hello'], {\n    count: 5,       // default\n    time: 1000,     // default\n    log: () => {},  // default\n});\n```\n\n## Related\n\n- [currify](https://github.com/coderaiser/currify \"currify\") - translate the evaluation of a function that takes multiple arguments into evaluating a sequence of functions, each with a single or more arguments.\n\n- [fullstore](https://github.com/coderaiser/fullstore \"fullstore\") - functional variables.\n\n- [wraptile](https://github.com/coderaiser/wraptile \"wraptile\") - translate the evaluation of a function that takes multiple arguments into evaluating a sequence of 2 functions, each with a any count of arguments.\n\n## License\n\nMIT\n\n[NPMIMGURL]: https://img.shields.io/npm/v/@iocmd/hold-up.svg?style=flat\n[BuildStatusIMGURL]: https://travis-ci.com/iocmd/hold-up.svg?branch=master\n[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat\n[NPMURL]: https://npmjs.org/package/@iocmd/hold-up \"npm\"\n[BuildStatusURL]: https://travis-ci.com/iocmd/hold-up \"Build Status\"\n[LicenseURL]: https://tldrlegal.com/license/mit-license \"MIT License\"\n[CoverageURL]: https://coveralls.io/github/iocmd/hold-up?branch=master\n[CoverageIMGURL]: https://coveralls.io/repos/iocmd/hold-up/badge.svg?branch=master&service=github\n","publish_time":1649272130410,"_cnpm_publish_time":1649272130410,"dist-tags":{"latest":"2.1.0"}}