{"id":17437196,"url":"https://github.com/iocmd/hold-up","last_synced_at":"2025-07-05T12:36:28.319Z","repository":{"id":57119112,"uuid":"158233403","full_name":"iocmd/hold-up","owner":"iocmd","description":"setInterval with promises, counter and error handling","archived":false,"fork":false,"pushed_at":"2022-04-08T12:06:20.000Z","size":28,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-18T07:19:36.783Z","etag":null,"topics":["async","await","javascript","nodejs","promise","setinterval","settimeout"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iocmd.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-19T14:04:48.000Z","updated_at":"2023-12-02T20:31:17.000Z","dependencies_parsed_at":"2022-08-23T12:21:03.408Z","dependency_job_id":null,"html_url":"https://github.com/iocmd/hold-up","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/iocmd/hold-up","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iocmd%2Fhold-up","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iocmd%2Fhold-up/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iocmd%2Fhold-up/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iocmd%2Fhold-up/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iocmd","download_url":"https://codeload.github.com/iocmd/hold-up/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iocmd%2Fhold-up/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261200387,"owners_count":23123947,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","await","javascript","nodejs","promise","setinterval","settimeout"],"created_at":"2024-10-17T11:06:41.718Z","updated_at":"2025-07-05T12:36:28.298Z","avatar_url":"https://github.com/iocmd.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"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 `throws` run it again with interval (defaults to 1 second) `counter` times (defaults to 5). If it fails, promise rejects, 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') =\u003e {\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: () =\u003e {},  // 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\u0026service=github\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiocmd%2Fhold-up","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiocmd%2Fhold-up","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiocmd%2Fhold-up/lists"}