Rememor
Simple memoization module, to speed up recursion, and calls to expensive functions.
Installation
$ npm install rememor
Usage
const remem = ; //remem.doc(true) prints out a little info on the module. let a + b; const memAdd = remem; ; 3 ; 3 //But uses cache instead of calculating. let { ifn !== 0 && n !== 1 return + ; else return n; } let memFib = remem; //First argument is recursive function, second argument is the name //of the recursive function to be replaced with the original function definition. ; uses caches within ; //This is an approximation using memoization kindaLog(.1000000007); => //Calculates using original function kindaLog(.1000000006); => //Returns the cached value for the previous call because similar args.
Warning:
Be careful when using deepRemem, it modifies the function.