{"id":17242785,"url":"https://github.com/imcuttle/prom-race","last_synced_at":"2025-03-26T03:44:22.437Z","repository":{"id":57331200,"uuid":"165795561","full_name":"imcuttle/prom-race","owner":"imcuttle","description":"A better `Promise.race`","archived":false,"fork":false,"pushed_at":"2022-01-07T14:00:14.000Z","size":90,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T12:21:19.074Z","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/imcuttle.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-01-15T06:12:15.000Z","updated_at":"2019-01-15T12:37:21.000Z","dependencies_parsed_at":"2022-09-14T19:02:00.342Z","dependency_job_id":null,"html_url":"https://github.com/imcuttle/prom-race","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/imcuttle%2Fprom-race","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imcuttle%2Fprom-race/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imcuttle%2Fprom-race/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imcuttle%2Fprom-race/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imcuttle","download_url":"https://codeload.github.com/imcuttle/prom-race/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245585797,"owners_count":20639671,"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-10-15T06:14:03.746Z","updated_at":"2025-03-26T03:44:22.417Z","avatar_url":"https://github.com/imcuttle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# prom-race\n\n[![Build status](https://img.shields.io/travis/imcuttle/prom-race/master.svg?style=flat-square)](https://travis-ci.org/imcuttle/prom-race)\n[![Test coverage](https://img.shields.io/codecov/c/github/imcuttle/prom-race.svg?style=flat-square)](https://codecov.io/github/imcuttle/prom-race?branch=master)\n[![NPM version](https://img.shields.io/npm/v/prom-race.svg?style=flat-square)](https://www.npmjs.com/package/prom-race)\n[![NPM Downloads](https://img.shields.io/npm/dm/prom-race.svg?style=flat-square\u0026maxAge=43200)](https://www.npmjs.com/package/prom-race)\n[![Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://prettier.io/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?style=flat-square)](https://conventionalcommits.org)\n\n\u003e A better `Promise.race`\n\n## Why use It?\n\n1.  `Promise.race()` returning a forever pending promise when supplied an empty iterable, but `prom-race` will NOT!\n2.  `prom-race` will call the others promises' `cancel` method if possible.\n\n## Installation\n\n```bash\nnpm install prom-race\n# or use yarn\nyarn add prom-race\n```\n\n## Usage\n\n```javascript\nconst promRace = require('prom-race')\n```\n\n## API\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n### race\n\n[index.js:14-58](https://github.com/imcuttle/prom-race/blob/afe739cf5ae833b7a169ca57bcb4c14b63ed20fd/index.js#L14-L58 'Source code on GitHub')\n\n#### Parameters\n\n- `iterable` {Iterable}\n  An iterable object, such as an Array.\n- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** {{}}\n  - `options.cancelWhenFinished` {boolean} - Whether call the others promises' `cancel` method. (optional, default `true`)\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\u0026lt;any\u003e**\n\n## Contributing\n\n- Fork it!\n- Create your new branch:  \n  `git checkout -b feature-new` or `git checkout -b fix-which-bug`\n- Start your magic work now\n- Make sure npm test passes\n- Commit your changes:  \n  `git commit -am 'feat: some description (close #123)'` or `git commit -am 'fix: some description (fix #123)'`\n- Push to the branch: `git push`\n- Submit a pull request :)\n\n## Authors\n\nThis library is written and maintained by imcuttle, \u003ca href=\"mailto:moyuyc95@gmail.com\"\u003emoyuyc95@gmail.com\u003c/a\u003e.\n\n## License\n\nMIT - [imcuttle](https://github.com/imcuttle) 🐟\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimcuttle%2Fprom-race","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimcuttle%2Fprom-race","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimcuttle%2Fprom-race/lists"}