# promise-inflight

> One promise for multiple requests in flight to avoid async duplication

Latest version **1.0.1** (published 2017-02-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install promise-inflight
pnpm add promise-inflight
yarn add promise-inflight
bun add promise-inflight
```

## Health

**Score 23/100 (F)** — status: abandoned.

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-02-26 |
| First published | 2017-02-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | separate (@types/promise-inflight) |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 17 |
| Author | Rebecca Turner |
| Maintainers | iarna |

## Links

- npm: https://www.npmjs.com/package/promise-inflight
- Repository: https://github.com/iarna/promise-inflight
- Homepage: https://github.com/iarna/promise-inflight#readme
- Issues: https://github.com/iarna/promise-inflight/issues
- npm.io page: https://npm.io/package/promise-inflight

## Recent versions

- 1.0.1 (latest) — 2017-02-26
- 1.0.0 — 2017-02-25

## README

# promise-inflight

One promise for multiple requests in flight to avoid async duplication

## USAGE

```javascript
const inflight = require('promise-inflight')

// some request that does some stuff
function req(key) {
  // key is any random string.  like a url or filename or whatever.
  return inflight(key, () => {
    // this is where you'd fetch the url or whatever
    return Promise.delay(100)
  })
}

// only assigns a single setTimeout
// when it dings, all thens get called with the same result.  (There's only
// one underlying promise.)
req('foo').then(…)
req('foo').then(…)
req('foo').then(…)
req('foo').then(…)
```

## SEE ALSO

* [inflight](https://npmjs.com/package/inflight) - For the callback based function on which this is based.

## STILL NEEDS

Tests!

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