memoized

1.0.1 • Public • Published

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 (=== 0 || n === 1) {
    return n;
  } else {
    return fibonacci(- 1) + fibonacci(- 2);
  }
}
 
var fib = memoized.performance(fibonacci, 10);
fib(20);
 

Readme

Keywords

Package Sidebar

Install

npm i memoized

Weekly Downloads

84

Version

1.0.1

License

MIT

Last publish

Collaborators

  • gattermeier