{"id":29311492,"url":"https://github.com/abecodes/promise-helper","last_synced_at":"2026-02-18T05:01:44.624Z","repository":{"id":35137287,"uuid":"211548914","full_name":"abecodes/promise-helper","owner":"abecodes","description":"promise-helper is a simple toolbelt that aims to help with the more complex tasks of using promises. It supports operations like handling promises in sequence, sequences with sleeps, parallel execution or limited parallel execution, promises with timeout and cancelable promises.","archived":false,"fork":false,"pushed_at":"2025-02-19T14:33:32.000Z","size":238,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-22T22:05:26.821Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abecodes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-09-28T19:04:48.000Z","updated_at":"2024-08-03T14:49:11.000Z","dependencies_parsed_at":"2025-07-07T08:15:05.718Z","dependency_job_id":"863cfc18-c270-46e1-ad9f-3937c233e7bf","html_url":"https://github.com/abecodes/promise-helper","commit_stats":{"total_commits":14,"total_committers":3,"mean_commits":4.666666666666667,"dds":0.2142857142857143,"last_synced_commit":"c2d45039ec34c0912eedd57c6749eb8ebddcae30"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/abecodes/promise-helper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abecodes%2Fpromise-helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abecodes%2Fpromise-helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abecodes%2Fpromise-helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abecodes%2Fpromise-helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abecodes","download_url":"https://codeload.github.com/abecodes/promise-helper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abecodes%2Fpromise-helper/sbom","scorecard":{"id":160388,"data":{"date":"2025-08-11","repo":{"name":"github.com/abecodes/promise-helper","commit":"cdbcd0117e682903ebc7cccd70c3587e9bfbb71e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.9,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/3 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: The Unlicense: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 14 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":1,"reason":"9 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-16T13:14:43.336Z","repository_id":35137287,"created_at":"2025-08-16T13:14:43.336Z","updated_at":"2025-08-16T13:14:43.336Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29569853,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T04:18:28.490Z","status":"ssl_error","status_checked_at":"2026-02-18T04:13:49.018Z","response_time":162,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2025-07-07T08:15:02.576Z","updated_at":"2026-02-18T05:01:44.603Z","avatar_url":"https://github.com/abecodes.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# promise-helper\n\npromise-helper is a simple toolbelt that aims to help with the more complex tasks of using promises.\nIt supports operations like handling promises in sequence, sequences with sleeps,\nparallel execution or limited parallel execution, promises with timeout and cancelable promises.\n\nIt is released under the [UNLICENSE](https://unlicense.org/) \u0026 supports modern environments.\n\n## Installation\n\nUsing npm:\n\n```bash\n# global\n$ npm i -g @abecodes/promise-helper\n\n# dependency\n$ npm i -S @abecodes/promise-helper\n\n# dev dependecy\n$ npm i -D @abecodes/promise-helper\n```\n\nIn Node.js:\n\n```js\n// Require the package.\nconst ph = require(\"@abecodes/promise-helper\");\n```\n\n## API\n\n### sequence\n\n```javascript\n// Default\nph.sequence(taskArray: [() =\u003e Promise\u003cany\u003e], cb?: (err, result) =\u003e any) =\u003e Promise\u003cany\u003e\n\n// Adding timeout between each task\nph.sequence.withSleep(taskArray: [() =\u003e Promise\u003cany\u003e], timeout: number,cb?: (err, result) =\u003e any) =\u003e Promise\u003cany\u003e\n\n// Adding a random timeout inbetween a given range between each task\nph.sequence.withSleepRange(taskArray: [() =\u003e Promise\u003cany\u003e], minTime: number, maxTime: number, cb?: (err, result) =\u003e any) =\u003e Promise\u003cany\u003e\n```\n\nThe _sequence_ method takes an array of HOFs that return a promise an runs them in sequence. If _sequence.withSleep_ or _sequence.withSleepRange_ is called, the sequence will sleep after each task.\n\n_Sequence_ can be used as Promise or with a callback.\nIf one task fails, the whole sequence will fail.\nIn case of an error, all previous results will be accessable (if not falsy).\n\nIf used as promise, they will be passed in the error object as result property.\n\nIf used with a callback, they are passed as the result parameter.\n\n```javascript\n// Example\nconst p = ph.sequence.withSleep(\n\t[\n\t\t() =\u003e\n\t\t\tnew Promise((resolve, reject) =\u003e {\n\t\t\t\tsetTimeout(() =\u003e {\n\t\t\t\t\tresolve(\"Hello\");\n\t\t\t\t}, 200);\n\t\t\t}),\n\t\t() =\u003e\n\t\t\tnew Promise((resolve, reject) =\u003e {\n\t\t\t\tsetTimeout(() =\u003e {\n\t\t\t\t\tresolve(\"World\");\n\t\t\t\t}, 200);\n\t\t\t}),\n\t],\n\t2000\n);\np.then(res =\u003e console.log(res)).catch(err =\u003e console.log(err, err.result));\n```\n\n### parallel\n\n```javascript\n// Default\nph.parallel(taskArray: [() =\u003e Promise\u003cany\u003e], cb?: (err, result) =\u003e any) =\u003e Promise\u003cany\u003e\n\n// Triggering limited execution\nph.parallel.limited(taskArray: [() =\u003e Promise\u003cany\u003e], limit: number) =\u003e void\n```\n\nThe _parallel_ method takes an array of HOFs that return a promise an runs them in parallel.\n\nIf _parallel.limited_ is called,\nonly the given number of tasks will run in parallel.\n\n_Parallel_ can be used as Promise or with a callback.\nIf one task fails, the whole sequence will fail.\n\n_Parallel.limited_ returns void, so each task must be handled by itself during initialization.\n\n```javascript\n// Example\nph.parallel.limited(\n\t[\n\t\t() =\u003e\n\t\t\tnew Promise((resolve, reject) =\u003e {\n\t\t\t\tsetTimeout(() =\u003e {\n\t\t\t\t\tresolve(\"Hello\");\n\t\t\t\t}, 200);\n\t\t\t}).then(res =\u003e console.log(res)),\n\t\t() =\u003e\n\t\t\tnew Promise((resolve, reject) =\u003e {\n\t\t\t\tsetTimeout(() =\u003e {\n\t\t\t\t\tresolve(\"World\");\n\t\t\t\t}, 200);\n\t\t\t}).then(res =\u003e console.log(res)),\n\t\t() =\u003e\n\t\t\tnew Promise((resolve, reject) =\u003e {\n\t\t\t\tsetTimeout(() =\u003e {\n\t\t\t\t\treject(new Error(\"oO\"));\n\t\t\t\t}, 200);\n\t\t\t}).catch(res =\u003e console.log(res)),\n\t\t() =\u003e\n\t\t\tnew Promise((resolve, reject) =\u003e {\n\t\t\t\tsetTimeout(() =\u003e {\n\t\t\t\t\tresolve(\"working limited\");\n\t\t\t\t}, 200);\n\t\t\t}).then(res =\u003e console.log(res)),\n\t],\n\t2\n);\n```\n\n### timeout\n\n```javascript\n// Default (throws timeout)\nph.timeout((executor: (resolve: (value?: any) =\u003e void, reject: (reason?: any)) =\u003e void) =\u003e void, timeout: number, onTimeout?: () =\u003e any) =\u003e Promise\u003cany\u003e\n\n// Instead of throwing an error, withNull will resolve with null on timeout\nph.timeout.withNull((executor: (resolve: (value?: any) =\u003e void, reject: (reason?: any)) =\u003e void) =\u003e void, timeout: number, onTimeout?: () =\u003e any) =\u003e Promise\u003cany\u003e\n```\n\nThe _timeout_ method creates a promise that is bound to a timeout.\n\nIf the promise fails to respond in time, it will throw an error. If _timeout.withNull_ is used, it will resolve with null instead of throwing.\n\nDue to how promises work, the original promise will still execute, but if the operation offers a abort function, it can be triggered with the _onTimeout_ callback.\n\n```javascript\n// Example\nconst p = ph.timeout(\n\t(resolve, reject) =\u003e {\n\t\treq = https.get(\"https://www.google.de\", res =\u003e resolve(res));\n\t\treq.on(\"error\", err =\u003e reject(err));\n\t\treq.on(\"abort\", () =\u003e reject());\n\t},\n\t20,\n\t() =\u003e req.abort()\n);\np.then(res =\u003e console.log(res)).catch(err =\u003e console.log(err));\n```\n\n### cancelable\n\n```javascript\n// Invocation\nconst p = ph.cancelable((executor: (resolve: (value?: any) =\u003e void, reject: (reason?: any)) =\u003e void) =\u003e void) =\u003e Promise\u003cany\u003e\n\n// cancel (throws canceled)\np.cancel(onCancel?: () =\u003e void)\n\n// cancelWithNull resolves with null\np.cancelWithNull(onCancel?: () =\u003e void)\n```\n\nThe _cancelable_ method creates a promise that could be canceled at will.\n\nIf canceled, it will throw an error. If _cancelable.cancelWithNull_ is used, it will resolve with null instead of throwing.\n\nDue to how promises work, the original promise will still execute, but if the operation offers a abort function, it can be triggered with the _onCancel_ callback.\n\n```javascript\n// Example\nlet req;\n\nconst p = ph.cancelable((resolve, reject) =\u003e {\n\treq = https.get(\"https://www.google.de\", res =\u003e resolve(res));\n\treq.on(\"error\", err =\u003e reject(err));\n\treq.on(\"abort\", () =\u003e reject());\n});\np.then(res =\u003e console.log(res)).catch(err =\u003e console.log(err));\n\nsetTimeout(() =\u003e p.cancel(() =\u003e req.abort()), 20);\n```\n\n## Greetings\n\nMay you enjoy using this piece of software as much as I enjoyed writing it. Stay bug free and have an awesome day \u003c3\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabecodes%2Fpromise-helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabecodes%2Fpromise-helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabecodes%2Fpromise-helper/lists"}