# universal-memoize

> A library of universal memoization for sync/async function.

Latest version **1.0.4** (published 2017-06-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install universal-memoize
pnpm add universal-memoize
yarn add universal-memoize
bun add universal-memoize
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2017-06-07 |
| First published | 2017-06-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | yuruiyin |
| Maintainers | yuruiyin |
| Keywords | memoize, cache, async |

## Links

- npm: https://www.npmjs.com/package/universal-memoize
- Repository: https://github.com/yuruiyin/universal-memoize
- Homepage: https://github.com/yuruiyin/universal-memoize#readme
- Issues: https://github.com/yuruiyin/universal-memoize/issues
- npm.io page: https://npm.io/package/universal-memoize

## Dependencies (1)

- [babel-cli](https://npm.io/package/babel-cli.md) ^6.24.1

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2017-06-07
- 1.0.3 — 2017-06-07
- 1.0.2 — 2017-06-07
- 1.0.1 — 2017-06-07
- 1.0.0 — 2017-06-07

## README

# universal-memoize
A library of universal memoization for sync/async function. For async function, this library can just memoize the successful response of async request.

# Installation
```
npm install universal-memoize --save
```

# Usage
```
import memoize from 'universal-memoize'

// sync
const addOne = memoize(x => x + 1)
addOne(5).then(res => console.log(res)) // 6

//async
const fetchData = memoize(asyncFunc) //asyncFunc is your async function as 'uri => fetch(uri)'
fetchData(yourArgs).then(res => console.log(res))

```

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