Created
January 20, 2019 07:15
-
-
Save ryands17/38083aac83de7a546e59249c20a92038 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const memoize = fn => (...args) => { | |
fn.cache = fn.cache || {} | |
return fn.cache[args] ? fn.cache[args] : (fn.cache[args] = fn.apply(this,args)) | |
} | |
const memoizedFunction = memoize(funtionToMemoize) | |
memoizedFunction(args) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment