memoized
v1.0.1
Published
A memoize library with cache limitations governed by function call frequency or performance.
Downloads
164
Readme
Memoized
A small library to memoize functions for Node.js and web browser.
It supports limiting cache size and governing cache by the performance or frequency of function calls.
Installation
npm i memoized --saved
Usage
var memoized = memoized.frequency(func,limit);
Example
var memoized = require('memoized');
var fibonacci = function(n) {
if (n === 0 || n === 1) {
return n;
} else {
return fibonacci(n - 1) + fibonacci(n - 2);
}
}
var fib = memoized.performance(fibonacci, 10);
fib(20);