Skip to content

Gattermeier/memoized

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Memoize

npm version

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.

Usage

const memoized = memoize.frequency(func,limit);

Example

const memoize = require('./memoize.js');  

const fibonacci = (n) => {
  if (n === 0 || n === 1) {
    return n;
  } else {
    return fibonacci(n - 1) + fibonacci(n - 2);
  }
}

const fib = memoize.performance(fibonacci, 10);
fib(20);

About

A memoize library with cache limitations governed by function call frequency or performance. Use it for costly algorithmic problems like fibonacci numbers.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published