{"id":18484879,"url":"https://github.com/prscx/simplified-promise","last_synced_at":"2025-04-08T19:31:40.987Z","repository":{"id":57361494,"uuid":"116769377","full_name":"prscX/simplified-promise","owner":"prscX","description":"Enhance Simplicity of JS Promise","archived":false,"fork":false,"pushed_at":"2018-06-24T07:31:54.000Z","size":41,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T17:45:36.788Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/prscX.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":"2018-01-09T05:17:56.000Z","updated_at":"2021-07-04T08:11:32.000Z","dependencies_parsed_at":"2022-09-26T16:40:59.502Z","dependency_job_id":null,"html_url":"https://github.com/prscX/simplified-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/prscX%2Fsimplified-promise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prscX%2Fsimplified-promise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prscX%2Fsimplified-promise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prscX%2Fsimplified-promise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prscX","download_url":"https://codeload.github.com/prscX/simplified-promise/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247912643,"owners_count":21017032,"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-06T12:43:26.771Z","updated_at":"2025-04-08T19:31:40.646Z","avatar_url":"https://github.com/prscX.png","language":"JavaScript","funding_links":["https://www.buymeacoffee.com/prscX"],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"hero.png\" /\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/simplified-promise\"\u003e\u003cimg src=\"http://img.shields.io/npm/v/simplified-promise.svg?style=flat\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/prscX/simplified-promise/pulls\"\u003e\u003cimg alt=\"PRs Welcome\" src=\"https://img.shields.io/badge/PRs-welcome-brightgreen.svg\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/prscX/simplified-promise#License\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/simplified-promise.svg?style=flat\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\n    Simplified Promise\n\nIf this project has helped you out, please support us with a star 🌟\n\u003c/h1\u003e\n\nIt enhances the simplicity of JavaScript Promise by adding below static API's to the out of box Promise:\n\n- `Promise.Create(): Promise`\n- `Promise.All(): Promise`\n\n\n## ES6 Promise Usage\n`new Promise( /* executor */ function(resolve, reject) { ... } );`\n\n**Parameters**\n- __executor__: A function that is passed with the arguments resolve and reject\n\n\nIf we use standard Promise then it is mandatory to pass executor function:\n\n~~~~\nfunction myAsyncFunction(url) {\n  return new Promise((resolve, reject) =\u003e {\n    const xhr = new XMLHttpRequest();\n    xhr.open(\"GET\", url);\n    xhr.onload = () =\u003e resolve(xhr.responseText);\n    xhr.onerror = () =\u003e reject(xhr.statusText);\n    xhr.send();\n  });\n}\n~~~~\n\nDoing this we need to wrap our implementation in executor **Function**. In my opinion it increases source hierarchy\n\n\n## Why it is useful\n- It allows us to write neat \u0026 clean source\n- Less source hierarchy\n- Easy to use and understand\n\n\n## 💻 Usage\n`$ npm install --save simplified-promise`\n\n`import * from 'simplified-promise'`\n\n- Promise.Create\n\n~~~~\nfoo() {\n  let promise = Promise.Create()\n\n  asyncFoo()\n    .then(() =\u003e promise.resolve())\n    .catch(err =\u003e promise.reject(err))\n\n  return promise\n}\n~~~~\n\n- Promise.All\n\n~~~~\nfoo() {\n  let promises = []\n\n  promises.push(asyncFoo1())\n  promises.push(asyncFoo2())\n\n  return Promise.All(promises)\n}\n~~~~\n\n## ✨ Credits\n\n## 🤔 How to contribute\nHave an idea? Found a bug? Please raise to [ISSUES](https://github.com/prscX/simplified-promise/issues).\nContributions are welcome and are greatly appreciated! Every little bit helps, and credit will always be given.\n\n## 💫 Where is this library used?\nIf you are using this library in one of your projects, add it in this list below. ✨\n\n\n## 📜 License\nThis library is provided under the Apache 2 License.\n\nSimplified Promise @ [prscX](https://github.com/prscX)\n\n## 💖 Support my projects\nI open-source almost everything I can, and I try to reply everyone needing help using these projects. Obviously, this takes time. You can integrate and use these projects in your applications for free! You can even change the source code and redistribute (even resell it).\n\nHowever, if you get some profit from this or just want to encourage me to continue creating stuff, there are few ways you can do it:\n* Starring and sharing the projects you like 🚀\n* If you're feeling especially charitable, please follow [prscX](https://github.com/prscX) on GitHub.\n\n  \u003ca href=\"https://www.buymeacoffee.com/prscX\" target=\"_blank\"\u003e\u003cimg src=\"https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png\" alt=\"Buy Me A Coffee\" style=\"height: auto !important;width: auto !important;\" \u003e\u003c/a\u003e\n\n  Thanks! ❤️\n  \u003cbr/\u003e\n  [prscX.github.io](https://prscx.github.io)\n  \u003cbr/\u003e\n  \u003c/ Pranav \u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprscx%2Fsimplified-promise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprscx%2Fsimplified-promise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprscx%2Fsimplified-promise/lists"}