An open API service indexing awesome lists of open source software.

https://github.com/rubiin/memoize

A simple and easy to use memoize lib for deno
https://github.com/rubiin/memoize

deno typescript

Last synced: about 1 month ago
JSON representation

A simple and easy to use memoize lib for deno

Awesome Lists containing this project

README

          

## Usage

```js

const add = (a, b) => a + b;
const memoizedFn = memoize(add);

memoizedFn(1, 2); // 3

memoizedFn(1, 2); // 3
// Add function is not executed: previous result is returned

memoizedFn(2, 3); // 5
// Add function is called to get new value

memoizedFn(2, 3); // 5
// Add function is not executed: previous result is returned

memoizedFn(1, 2); // 3
// Add function is called to get new value.
// While this was previously cached,
// it is not the latest so the cached result is lost
```