1.0.1 • Published 8 years ago

memoized v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

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);