Skip to content

Instantly share code, notes, and snippets.

@enjoylife
Created August 3, 2012 20:17
Show Gist options
  • Save enjoylife/3251126 to your computer and use it in GitHub Desktop.
Save enjoylife/3251126 to your computer and use it in GitHub Desktop.
memoize snippet found
function memoizeConstantMethod(o, p) {
var f = o[p], mf;
var s = function(v) {return o[p]=v||mf};
((mf = function() {
(s(function(){return value})).reset = mf.reset;
return value = f.call(this);
}).reset = s)();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment