# @typescript-plus/fast-memoize-decorator

> A TypeScript decorator for memoizing properties using fast-memoize.

Latest version **0.2.1** (published 2021-10-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @typescript-plus/fast-memoize-decorator
pnpm add @typescript-plus/fast-memoize-decorator
yarn add @typescript-plus/fast-memoize-decorator
bun add @typescript-plus/fast-memoize-decorator
```

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2021-10-02 |
| First published | 2018-05-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | mosop |
| Maintainers | mosop |

## Links

- npm: https://www.npmjs.com/package/@typescript-plus/fast-memoize-decorator
- Repository: https://github.com/typescript-plus/fast-memoize-decorator
- Homepage: https://github.com/typescript-plus/fast-memoize-decorator#readme
- Issues: https://github.com/typescript-plus/fast-memoize-decorator/issues
- npm.io page: https://npm.io/package/@typescript-plus/fast-memoize-decorator

## Dependencies (1)

- [fast-memoize](https://npm.io/package/fast-memoize.md) ^2.5.2

## Recent versions

- 0.2.1 (latest) — 2021-10-02
- 0.2.0 — 2021-10-02
- 0.1.0 — 2018-05-30

## README

# fast-memoize Decorator

A TypeScript decorator for memoizing properties using [fast-memoize].

[![CircleCI](https://circleci.com/gh/typescript-plus/fast-memoize-decorator.svg?style=svg)](https://circleci.com/gh/typescript-plus/fast-memoize-decorator)

## Install

```bash
$ npm i @typescript-plus/fast-memoize-decorator --save
```

## Usage

```ts
import { Memoize } from '@typescript-plus/fast-memoize-decorator';

class Tomorrow {
  @Memoize() when(today: Date) {
    console.log('compute!');
    const date = new Date(today.getTime());
    date.setDate(date.getDate() + 1);
    return date;
  }
}

const tomorrow = new Tomorrow();

// returns 2nd Apr. 2000 and prints "compute!"
tomorrow.when(new Date(2000, 4, 1));

// returns 2nd Apr. 2000 and prints nothing
tomorrow.when(new Date(2000, 4, 1));

// returns 3rd Apr. 2000 and prints "compute!"
tomorrow.when(new Date(2000, 4, 2));
```

[fast-memoize]: https://www.npmjs.com/package/fast-memoize

## LICENSE

MIT

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