# hyper-async

> Async is a tiny FP library for javascript. It provides a small, composable abstraction over async effects with predictable error handling and strict composition semantics.

Latest version **1.2.0** (published 2025-09-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install hyper-async
pnpm add hyper-async
yarn add hyper-async
bun add hyper-async
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

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

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2025-09-20 |
| First published | 2023-04-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 0 |
| Unpacked size | 9.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Tom Wilson |
| Maintainers | permaweb |

## Links

- npm: https://www.npmjs.com/package/hyper-async
- Repository: https://github.com/twilson63/hyper-async
- Homepage: https://github.com/twilson63/hyper-async#readme
- Issues: https://github.com/twilson63/hyper-async/issues
- npm.io page: https://npm.io/package/hyper-async

## Recent versions

- 1.2.0 (latest) — 2025-09-20
- 1.1.2 — 2023-07-17
- 1.1.1 — 2023-05-22
- 1.1.0 — 2023-04-27
- 1.0.0 — 2023-04-27

## README

# hyper-async

Async is a tiny FP library for javascript. It provides a small, composable abstraction over async effects with predictable error handling and strict composition semantics.

## install

```sh
npm install hyper-async
```

## Usage

### Composition and errors

- `map(fn)`: `fn` must be a function. Sync throws inside `fn` are caught and become a rejected Async.
- `chain(fn)`: `fn` must return an `Async`. If it returns anything else, the chain rejects with a `TypeError`.
- `bimap(rejFn, resFn)`: both args must be functions.
- `bichain(rejFn, resFn)`: both args must return `Async`.
- `fold(rejFn, resFn)`: both args must return `Async`.
- `fromPromise(f)`: `f` must be a function; sync throws reject the `Async`.

Errors never escape; they surface as a rejected `Async` (and thus a rejected `.toPromise()`).

```js
import Async from "hyper-async";

const prop = (k) => (o) => o[k];

async function main() {
  const x = await Async.of(1)
    .chain((n) => Async.fromPromise(fetch)(`https://example.test/posts/${n}`))
    .chain((res) => Async.fromPromise(res.json.bind(res))())
    .map(prop("title"))
    .toPromise();
  console.log(x);
}

main();
```

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