# fp-future

> > A Future is a placeholder object for a value that may not yet exist

Latest version **1.0.1** (published 2019-02-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install fp-future
pnpm add fp-future
yarn add fp-future
bun add fp-future
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2019-02-08 |
| First published | 2018-12-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Maintainers | menduz |

## Links

- npm: https://www.npmjs.com/package/fp-future
- Repository: https://github.com/menduz/fp-future
- Homepage: https://github.com/menduz/fp-future#readme
- Issues: https://github.com/menduz/fp-future/issues
- npm.io page: https://npm.io/package/fp-future

## Recent versions

- 1.0.1 (latest) — 2019-02-08
- 1.0.0 — 2018-12-17

## README

> A Future is a placeholder object for a value that may not yet exist


# Installation

```bash
npm install fp-future
```

# FP Future library

It is useful for blackbox testing without weird injections and other things.

```ts
it("executes the callback", async () => {
  const somethingToBeResolved = future();

  entity.onClick(event => {
    somethingToBeResolved.resolve(event);
  });

  const nonce = Math.random();

  setTimeout(() => somethingToBeResolved.reject(new Error("timeout")), 1000);

  entityEngine.triggerClick(nonce);

  const receivedNonce = await somethingToBeResolved;

  expect(receivedNonce).toEq(nonce);
});
```

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