Skip to content

Instantly share code, notes, and snippets.

@ryands17
Created January 20, 2019 07:15
Show Gist options
  • Save ryands17/38083aac83de7a546e59249c20a92038 to your computer and use it in GitHub Desktop.
Save ryands17/38083aac83de7a546e59249c20a92038 to your computer and use it in GitHub Desktop.
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