{"id":15866261,"url":"https://github.com/kanitsharma/yieldpromise","last_synced_at":"2025-07-30T09:37:10.413Z","repository":{"id":140496915,"uuid":"132175040","full_name":"kanitsharma/yieldpromise","owner":"kanitsharma","description":" Yield promises in generator functions","archived":false,"fork":false,"pushed_at":"2018-07-08T20:56:29.000Z","size":102,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-07T13:44:07.443Z","etag":null,"topics":["async","generator","iterables","javascript","promises"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/yieldpromise","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/kanitsharma.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":"2018-05-04T18:23:33.000Z","updated_at":"2018-07-08T20:56:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"4d34253f-0988-4f90-9720-f7c4d9c99fcc","html_url":"https://github.com/kanitsharma/yieldpromise","commit_stats":{"total_commits":14,"total_committers":2,"mean_commits":7.0,"dds":0.3571428571428571,"last_synced_commit":"e47ee44ea67ba9ac923cf79faa537e1cb6a115f8"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanitsharma%2Fyieldpromise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanitsharma%2Fyieldpromise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanitsharma%2Fyieldpromise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanitsharma%2Fyieldpromise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kanitsharma","download_url":"https://codeload.github.com/kanitsharma/yieldpromise/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246709914,"owners_count":20821298,"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","generator","iterables","javascript","promises"],"created_at":"2024-10-05T23:05:22.735Z","updated_at":"2025-04-01T20:48:43.762Z","avatar_url":"https://github.com/kanitsharma.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yieldpromise\n\nYield promises in generator functions\n\n## Getting started\n\n```javascript\n  npm i -s yieldpromise\n```\n\n### Usage\n\n```javascript\nconst run = require(\"yieldpromise\");\nconst fetch = require(\"node-fetch\");\n\n// Using as a standalone function\nrun(function* main() {\n  const a = yield fetch(\"https://jsonplaceholder.typicode.com/posts/1\");\n  const b = yield a.json();\n  console.log(b);\n});\n```\n\n#### Since run injects resolve and reject as parameters to the child generator function, it can be used inside promise chain\n\n##### Example\n\n```javascript\nconst run = require(\"yieldpromise\");\nconst fetch = require(\"node-fetch\");\n\nrun(function* main(resolve, reject) {\n  const a = yield fetch(\"https://jsonplaceholder.typicode.com/posts/1\");\n  const b = yield a.json();\n  resolve(b);\n})\n  .then(x =\u003e x.userId)\n  .then(console.log);\n```\n\n##### OR\n\n```javascript\nconst run = require(\"yieldpromise\");\nconst fetch = require(\"node-fetch\");\n\nfetch(\"https://jsonplaceholder.typicode.com/posts/1\")\n  .then(x =\u003e\n    run(function* main(resolve, reject) {\n      const a = yield x.json();\n      const b = a.userId;\n      resolve(b);\n    })\n  )\n  .then(console.log);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkanitsharma%2Fyieldpromise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkanitsharma%2Fyieldpromise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkanitsharma%2Fyieldpromise/lists"}