# just-memoize

> An implementation of the memoize technique

Latest version **2.2.0** (published 2022-12-17) · MIT license · 0 weekly downloads

## Install

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

## Health

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

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2022-12-17 |
| First published | 2021-04-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6186 |
| Author | evandrolg |
| Maintainers | angus-c |
| Keywords | memoize, function, just |

## Links

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

## Recent versions

- 2.2.0 (latest) — 2022-12-17
- 2.1.1 — 2022-08-08
- 2.1.0 — 2022-08-07
- 2.0.1 — 2021-11-13
- 2.0.0 — 2021-11-09
- 1.3.2 — 2021-11-02
- 1.3.1 — 2021-11-01
- 1.3.0 — 2021-10-31
- 1.2.0 — 2021-10-23
- 1.1.0 — 2021-04-02
- 1.0.0 — 2021-04-01

## README

<!-- DO NOT EDIT THIS FILE! THIS FILE WAS AUTOGENERATED BY TEMPLATE-MATE -->
<!-- SEE https://github.com/angus-c/just/blob/master/CONTRIBUTING.md#readme-template -->

## just-memoize

Part of a [library](https://anguscroll.com/just) of zero-dependency npm modules that do just do one thing.
Guilt-free utilities for every occasion.

[`🍦 Try it`](https://anguscroll.com/just/just-memoize)

```shell
npm install just-memoize
```
```shell
yarn add just-memoize
```

An implementation of the memoize technique

```js
import memoize from 'just-memoize';

const sumByOne = memoize(function(value) {
  return value + 1;
});

sumByOne(10); // Returns value returned by the function
sumByOne(10); // Cache hit!

sumByOne(20); // Returns value returned by the function
sumByOne(20); // Cache hit!

// Custom cache key (key defaults to JSON stringified arguments)
var sum = memoize(function(a, b) {
  return a + b;
}, function(a, b) {
  return `${a}-${b}`;
});

sum(10, 10); // Returns value returned by the function
sum(10, 20); // Returns value returned by the function
sum(10, 20); // Cache hit!
```

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