{"id":16703513,"url":"https://github.com/kolengri/async-wrapus","last_synced_at":"2026-04-28T18:35:44.750Z","repository":{"id":42809862,"uuid":"269649048","full_name":"kolengri/async-wrapus","owner":"kolengri","description":"🍭 Make async requests sweet again! Wrapper for async functions without pain. No try catches anymore.","archived":false,"fork":false,"pushed_at":"2025-02-18T17:31:53.000Z","size":229,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-25T23:55:31.055Z","etag":null,"topics":["async","await","javascript","try-catch","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/kolengri.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}},"created_at":"2020-06-05T13:39:26.000Z","updated_at":"2025-02-18T17:31:57.000Z","dependencies_parsed_at":"2023-02-05T16:30:44.701Z","dependency_job_id":null,"html_url":"https://github.com/kolengri/async-wrapus","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/kolengri/async-wrapus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kolengri%2Fasync-wrapus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kolengri%2Fasync-wrapus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kolengri%2Fasync-wrapus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kolengri%2Fasync-wrapus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kolengri","download_url":"https://codeload.github.com/kolengri/async-wrapus/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kolengri%2Fasync-wrapus/sbom","scorecard":{"id":566325,"data":{"date":"2025-08-11","repo":{"name":"github.com/kolengri/async-wrapus","commit":"9cc3f29d306c82517629c6f1d87d16fe7bcdb37a"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"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":"Code-Review","score":0,"reason":"Found 0/20 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":"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":"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":"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":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"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: MIT License: 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":"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":"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 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"}}]},"last_synced_at":"2025-08-20T15:04:26.192Z","repository_id":42809862,"created_at":"2025-08-20T15:04:26.192Z","updated_at":"2025-08-20T15:04:26.192Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32394467,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T14:34:11.604Z","status":"ssl_error","status_checked_at":"2026-04-28T14:32:37.009Z","response_time":56,"last_error":"SSL_read: 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":["async","await","javascript","try-catch","typescript"],"created_at":"2024-10-12T19:08:34.595Z","updated_at":"2026-04-28T18:35:44.731Z","avatar_url":"https://github.com/kolengri.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# async-wrapus\n\nAn elegant wrapper for async functions that eliminates the need for try-catch blocks and makes error handling more straightforward.\n\n[![NPM](https://img.shields.io/npm/v/async-wrapus.svg)](https://www.npmjs.com/package/async-wrapus)\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n[![Badges](https://badgen.net/npm/license/async-wrapus)](https://www.npmjs.com/package/async-wrapus)\n[![Badges](https://badgen.net/npm/dependents/async-wrapus)](https://www.npmjs.com/package/async-wrapus)\n[![Badges](https://badgen.net/npm/types/async-wrapus)](https://www.npmjs.com/package/async-wrapus)\n[![Badges](https://badgen.net/github/issues/kolengri/async-wrapus)](https://www.npmjs.com/package/async-wrapus)\n[![Badges](https://badgen.net/bundlephobia/min/async-wrapus)](https://bundlephobia.com/result?p=async-wrapus)\n[![Badges](https://badgen.net/bundlephobia/minzip/async-wrapus)](https://bundlephobia.com/result?p=async-wrapus)\n\n## Description\n\n`async-wrapus` is a lightweight utility that simplifies error handling in asynchronous operations. It transforms the traditional try-catch pattern into a more functional approach, inspired by Go's error handling pattern.\n\n### Why use async-wrapus?\n\n- **Clean Code**: Eliminates nested try-catch blocks that can make code harder to read\n- **Type Safety**: Full TypeScript support with proper type inference\n- **Predictable Error Handling**: Consistent error handling pattern across your application\n- **Zero Dependencies**: Lightweight and simple implementation\n- **Universal**: Works in Node.js and browser environments\n\n## Install\n\n```bash\nnpm install --save async-wrapus\n```\n\n```bash\nyarn add async-wrapus\n```\n\n## Usage\n\n### Basic Example\n\n```tsx\nimport asyncWrap from 'async-wrapus';\n\nconst fetchUserData = async (userId: string) =\u003e {\n  const [error, data] = await asyncWrap(api.fetchUser(userId));\n  \n  if (error) {\n    console.error('Failed to fetch user:', error.message);\n    return null;\n  }\n  \n  return data;\n};\n```\n\n### Advanced Usage\n\n```tsx\nimport asyncWrap from 'async-wrapus';\n\nconst complexOperation = async () =\u003e {\n  // Multiple async operations\n  const [dbError, dbResult] = await asyncWrap(database.query());\n  if (dbError) {\n    // Handle database error\n    return [dbError, null];\n  }\n\n  // Chain operations\n  const [apiError, apiResult] = await asyncWrap(api.process(dbResult));\n  if (apiError) {\n    // Handle API error\n    return [apiError, null];\n  }\n\n  return [null, { db: dbResult, api: apiResult }];\n};\n\n// Using with Promise.all\nconst batchOperation = async () =\u003e {\n  \n  const operations = [\n    Promise.resolve(\"test\"),\n    Promise.reject(\"reject\"),\n    Promise.resolve(\"test\"),\n  ];\n  \n  const [error, results] = await asyncWrap(Promise.all(operations));\n  \n  // Check if any operation failed\n  if (error) {\n    // Handle errors\n  }\n};\n\n\n// Using with Promise.all\nconst batchOperation = async () =\u003e {\n  const operations = [\n    api.operation1(),\n    api.operation2(),\n    api.operation3()\n  ].map(asyncWrap);\n  \n  const results = await Promise.all(operations);\n  \n  // Check if any operation failed\n  const hasError = results.some(([error]) =\u003e error !== null);\n  if (hasError) {\n    // Handle errors\n  }\n```\n\n## Return Type\n\nThe wrapper returns a tuple (array) with two elements:\n- First element: `Error | null` - Error object if operation failed, null if successful\n- Second element: `T | null` - Result of the operation if successful, null if failed\n\n```tsx\ntype AsyncWrapResult\u003cT\u003e = Promise\u003c[Error | null, T | null]\u003e;\n```\n\n## Error Handling Examples\n\n```tsx\nconst [error, result] = await asyncWrap(someAsyncOperation());\n\n// Pattern 1: Early return\nif (error) {\n  return handleError(error);\n}\n\n// Pattern 2: Error logging\nif (error) {\n  logger.error('Operation failed:', error);\n  return fallbackValue;\n}\n\n// Pattern 3: Conditional logic\nif (error) {\n  if (error instanceof NetworkError) {\n    // Handle network errors\n  } else if (error instanceof ValidationError) {\n    // Handle validation errors\n  }\n}\n```\n\n## License\n\nMIT © [kolengri](https://github.com/kolengri)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkolengri%2Fasync-wrapus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkolengri%2Fasync-wrapus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkolengri%2Fasync-wrapus/lists"}