{"id":28026884,"url":"https://github.com/kaufmanhenry/aplus-await","last_synced_at":"2025-05-11T06:23:16.817Z","repository":{"id":34943949,"uuid":"192520128","full_name":"kaufmanhenry/aplus-await","owner":"kaufmanhenry","description":"A simple way of handling async/await responses with array destructuring.","archived":false,"fork":false,"pushed_at":"2023-01-04T00:49:17.000Z","size":1133,"stargazers_count":5,"open_issues_count":12,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-11T00:04:25.208Z","etag":null,"topics":["async","async-await","destructuring","javascript","promise-wrapper","promises"],"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/kaufmanhenry.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":"2019-06-18T10:41:31.000Z","updated_at":"2023-03-11T12:29:08.000Z","dependencies_parsed_at":"2023-01-15T11:01:01.018Z","dependency_job_id":null,"html_url":"https://github.com/kaufmanhenry/aplus-await","commit_stats":null,"previous_names":["hcjk/aplus-await","hcjk/two-arg-promise"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaufmanhenry%2Faplus-await","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaufmanhenry%2Faplus-await/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaufmanhenry%2Faplus-await/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaufmanhenry%2Faplus-await/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaufmanhenry","download_url":"https://codeload.github.com/kaufmanhenry/aplus-await/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253524957,"owners_count":21922002,"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","async-await","destructuring","javascript","promise-wrapper","promises"],"created_at":"2025-05-11T06:23:16.200Z","updated_at":"2025-05-11T06:23:16.810Z","avatar_url":"https://github.com/kaufmanhenry.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# aplus-await [![travis-badge](https://travis-ci.org/hcjk/aplus-await.svg?branch=master)](https://travis-ci.org/hcjk/aplus-await)\n\nA simple way of handling async/await responses with array destructuring. The original concept for this package was derived from [Promises/A+](https://promisesaplus.com).\n\n## Install\n\n```shell\n$ yarn add aplus-await\n```\n\n## Usage\n```js\n// Instead of writing\nlet result;\ntry {\n  result = await promise();\n} catch (error) {\n  throw new Error(error);\n}\nconsole.log(result);\n\n// You can write\nconst [result, error] = await aplusAwait(promise);\nif (error) throw new Error(error);\nconsole.log(result);\n```\n\n## API\n\nWhen you wrap a promise with `aplusAwait`, you are guaranteed to be returned two arguments in the form of an array. The first element is the response of the promise and the second element is any error that occurred while executing the promise.\n\nIf you do not care about the error:\n```js\nconst [result] = await aplusAwait(promise);\n```\n\nIf you just want the error:\n```js\nconst [,error] = await aplusAwait(promise);\n```\n\nIf you do not want to use array destructuring:\n```js\nconst response = await aplusAwait(promise);\n// response[0] = result\n// response[1] = error\n```\n\n## License\n\nMIT © [Henry Kaufman](http://github.com/hcjk)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaufmanhenry%2Faplus-await","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaufmanhenry%2Faplus-await","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaufmanhenry%2Faplus-await/lists"}