{"id":16388472,"url":"https://github.com/lensh/mini-promise","last_synced_at":"2026-06-07T03:30:15.962Z","repository":{"id":81105435,"uuid":"227424251","full_name":"lensh/mini-promise","owner":"lensh","description":"Mini version promise based on promise a + specification supports asynchronous chain call.","archived":false,"fork":false,"pushed_at":"2019-12-11T17:38:16.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-03T10:12:04.393Z","etag":null,"topics":["promise"],"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/lensh.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-11T17:35:56.000Z","updated_at":"2019-12-11T17:41:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"3ebadd59-fbf3-4839-844f-27e412255add","html_url":"https://github.com/lensh/mini-promise","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lensh%2Fmini-promise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lensh%2Fmini-promise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lensh%2Fmini-promise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lensh%2Fmini-promise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lensh","download_url":"https://codeload.github.com/lensh/mini-promise/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240190994,"owners_count":19762598,"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":["promise"],"created_at":"2024-10-11T04:29:12.121Z","updated_at":"2026-06-07T03:30:15.926Z","avatar_url":"https://github.com/lensh.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## MyPromise\nMini version promise based on promise a + specification supports asynchronous chain call.\n## Support\n* new MyPromise\n* MyPromise.prototype.then  \n* MyPromise.prototype.catch\n* MyPromise.all  \n* MyPromise.race\n* MyPromise.resolve\n* MyPromise.reject\n## Usage\n```js\nimport 'colors'\nimport { MyPromise } from '../lib/MyPromise'\n\nconst log = console.log\n\n// test asynchronous chain call promsie\nlet p = new MyPromise((res, rej) =\u003e {\n\tsetTimeout(() =\u003e {\n\t\tres(1)\n\t}, 600)\n}).then(ret1 =\u003e {\n\tlog('then1:'.green, ret1)\n\treturn MyPromise.resolve(2)\n}).then().then(ret2 =\u003e {\n\tlog('then2:'.magenta, ret2)\n})\n\n// generate a promise array\nlet arr = [1, 2, 3, 4, 5].map((t, i) =\u003e {\n\treturn new MyPromise((res, rej) =\u003e {\n\t\tsetTimeout(() =\u003e {\n\t\t\tres(t)\n\t\t}, i * 1000)\n\t})\n})\n// test promise.all\nMyPromise.all(arr).then(ret =\u003e {\n\tlog('promise.all'.rainbow, ret)\n})\n// test promise.race\nMyPromise.race(arr).then(ret =\u003e {\n\tlog('promise.race'.yellow, ret)\n})\n\n// test promise.resolve\nlet p1 = MyPromise.resolve(2)\np1.then(ret =\u003e {\n\tlog('promsie.resolve'.cyan, ret)\n})\n\n// test promise.reject\nlet p2 = MyPromise.reject(3)\np2.catch(e =\u003e {\n\tlog('promsie.reject'.red, e)\n})\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flensh%2Fmini-promise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flensh%2Fmini-promise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flensh%2Fmini-promise/lists"}