# race-as-promised

> Alternate Promise.race() implementation which doesn't leak memory, courtesy Brian Kim (https://github.com/brainkim)

Latest version **0.0.3** (published 2023-09-20) · Unlicense license · 0 weekly downloads

## Install

```sh
npm install race-as-promised
pnpm add race-as-promised
yarn add race-as-promised
bun add race-as-promised
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2023-09-20 |
| First published | 2021-11-30 |
| Weekly downloads | 0 |
| License | Unlicense |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Maintainers | digitalloggers-szakharchenko |
| Keywords | promise, race, leak |

## Links

- npm: https://www.npmjs.com/package/race-as-promised
- Repository: https://github.com/digitalloggers/race-as-promised
- Homepage: https://github.com/digitalloggers/race-as-promised#readme
- Issues: https://github.com/digitalloggers/race-as-promised/issues
- npm.io page: https://npm.io/package/race-as-promised

## Alternatives

- [promise-throttle](https://npm.io/package/promise-throttle.md) — 44.2K weekly downloads
- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2023-09-20
- 0.0.2 — 2023-07-06
- 0.0.1 — 2021-11-30

## README

# race-as-promised

This module implements `Promise.race()` in a way that does not leak
memory.

## Rationale

The V8 Promise implementation does leak memory in many common
`Promise.race([...])` call cases; see
e.g. https://github.com/nodejs/node/issues/17469.

The V8 Promise implementation is likely [not going to be
fixed](https://github.com/nodejs/node/issues/17469#issuecomment-349794909).

See also: https://bugs.chromium.org/p/v8/issues/detail?id=9858

## Installation

```bash
npm install race-as-promised
```

## Usage

```js
const race = require ("race-as-promised");

// Use race([...]) instead of Promise.race([...])
```

## Author

The source code and test core [have been made available under The
Unlicense](https://github.com/nodejs/node/issues/17469#issuecomment-776343813)
by [Brian Kim](https://github.com/brainkim), to whom we owe our gratitude.

An additional issue in the original code has been found and fixed by
[Dan Bornstein](https://github.com/danfuzz), whose efforts are
likewise appreciated.

## License

[The Unlicense](https://spdx.org/licenses/Unlicense.html)

---
_Source: https://npm.io/package/race-as-promised · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
