Share your code. Components are building blocks, you are the architect.

utils/memoize
v1.1.0
1.1.0
1.0.0
MIT
PUBLIC
3
Build: fail
BuildFail
Build Status: fail
Creates a new function that, when invoked, caches the result of calling `fn`

Please configure Bit as a scoped registry to install components with NPM.Learn more

npm config set '@bit:registry' https://node.bitsrc.io
Use utils/memoize in your project
npm i @bit/bit.ramda.utils.memoize
Copied

memoize (fn:Function) : Function

Creates a new function that, when invoked, caches the result of calling fn for a given argument set and returns the result. Subsequent calls to the memoized fn with the same argument set will not result in an additional call to fn; instead, the cached result for that set of arguments will be returned.

Example

let count = 0;
     const factorial = R.memoize(n => {
       count += 1;
       return R.product(R.range(1, n + 1));
     });
     factorial(5); //=> 120
     factorial(5); //=> 120
     factorial(5); //=> 120
     count; //=> 1

Argument

fn: Function

The function to memoize.

Returns

Function

Memoized version of `fn`.