fast-memoize
Advanced tools
Comparing version 2.0.0 to 2.0.1
{ | ||
"name": "fast-memoize", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Fastest memoization lib that supports N arguments", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -43,2 +43,33 @@ <img src="http://rawgit.com/caiogondim/fast-memoize/master/img/icon.svg" width="100%" /> | ||
### Custom cache | ||
The fastest cache is used for the running enviroment, but it is possible to | ||
pass a custom cache to be used. | ||
```js | ||
const memoized = memoize(fn, { | ||
cache: customCache | ||
}) | ||
``` | ||
The custom cache must implement the following methods: | ||
- `get` | ||
- `set` | ||
- `has` | ||
- `delete` | ||
### Custom serializer | ||
To use a custom serializer: | ||
```js | ||
const memoized = memoize(fn, { | ||
serializer: customSerializer | ||
}) | ||
``` | ||
The serializer is a function that receives one argument and outputs a string | ||
that represents it. It has to be a | ||
[deterministic algorithm](https://en.wikipedia.org/wiki/Deterministic_algorithm) | ||
meaning that, given one input, it always give the same output. | ||
## Benchmark | ||
@@ -45,0 +76,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22804
130