{"id":22014117,"url":"https://github.com/laqudee/custom-promise","last_synced_at":"2026-05-03T13:34:41.252Z","repository":{"id":205936906,"uuid":"715388353","full_name":"laqudee/custom-promise","owner":"laqudee","description":"Promise custom-promise","archived":false,"fork":false,"pushed_at":"2023-12-24T02:12:06.000Z","size":36,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-28T15:18:49.708Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/laqudee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-11-07T03:19:36.000Z","updated_at":"2023-11-07T08:05:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"974db693-a35f-43e8-b7ca-d90faa227f09","html_url":"https://github.com/laqudee/custom-promise","commit_stats":null,"previous_names":["laqudee/custom-promise"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laqudee%2Fcustom-promise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laqudee%2Fcustom-promise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laqudee%2Fcustom-promise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laqudee%2Fcustom-promise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/laqudee","download_url":"https://codeload.github.com/laqudee/custom-promise/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245075296,"owners_count":20556904,"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":[],"created_at":"2024-11-30T03:26:24.181Z","updated_at":"2026-05-03T13:34:36.208Z","avatar_url":"https://github.com/laqudee.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Custom Promise\n\nImplement a custom Promise in JavaScript\n\n\u003e [Reference Shubham Khatri](https://medium.com/nerd-for-tech/implement-your-own-promises-in-javascript-68ddaa6a5409)\n\n## Usage\n\n### Installation\n\n```sh\npnpm add @laqudee/custom-promise\n```\n\n### examples\n\n```json\n{\n  \"name\": \"custom-promise-test\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  //   \"type\": \"module\",  // if add type: module; test:cjs can't work\n  \"scripts\": {\n    \"test\": \"node src/test.es.js\",\n    \"test:es\": \"node src/test.es.mjs\",\n    \"test:cjs\": \"node src/test.cjs.js\"\n  },\n  \"keywords\": [],\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"dependencies\": {\n    \"@laqudee/custom-promise\": \"^1.0.0\"\n  }\n}\n```\n\n```js\n// for cjs test.cjs.js\nconst CustomPromise = require('custom-promise')\n\n// for es test.es.js with type: module(in package.json) or test.es.mjs\nimport CustomPromise from 'custom-promise'\n```\n\n## Local Development\n\n```sh\n# build\npnpm build\n```\n\n```sh\n# link fro global\npnpm link --global\n\n# when use custom-promise\npnpm link --global @laqudee/custom-promise\n\n# test\npnpm test:es\npnpm test:cjs\n```\n\n### Promises/A+ Compliance Test Suite\n\nThis suite tests compliance of a promise implementation with the Promises/A+ specification.\n\n[Promises/A+ CTS](https://github.com/promises-aplus/promises-tests/blob/master/README.md)\n\n- add `promise-aplus-tests`\n\n```sh\npnpm add promises-aplus-tests -D\n```\n\n- add script cammand\n\n```json\n\"scripts\": {\n  \"test\": \"promises-aplus-tests promise-a-plus-test.js\"\n}\n```\n\n- run test\n\n```sh\npnpm test\n```\n\n\u003e This lib is temporarily uninstalled because it uses an older version of mocha that is causing some security issues. You can use this lib locally to test custom promises, but make sure it is uninstalled when you publish your own repository or npm package.\n\n- [NPM or Github complains about security issues](https://github.com/promises-aplus/promises-tests/issues/94)\n\n### `pnpm dev` Instructions\n\n- `pnpm dev` will use `node` and [`esm`](https://www.npmjs.com/package/esm) execute the `src/index.js` file.\n\n## Implement Process\n\n### States, Handlers and value\n\n- States:\n\n  - Pending\n  - Fulfilled\n  - Rejected\n\n- Handlers\n\n  - then()\n  - catch()\n  - finally()\n\n- value\n  - resolve() return value\n  - reject() return reason\n\n### Start Coding\n\n\u003e A Promise is executed as soon as it is created, so callback function will be called inside the constructor with reject and resolve methods passed as paramenters to it.\n\n\n[refer to: Building Promises from scratch](https://north-impulse-b83.notion.site/Promise-Async-await-d48658273084405a8b9cfd357e0926fe?pvs=4)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaqudee%2Fcustom-promise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaqudee%2Fcustom-promise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaqudee%2Fcustom-promise/lists"}