Skip to content

Instantly share code, notes, and snippets.

View 71104's full-sized avatar

Alberto La Rocca 71104

View GitHub Profile
function memoize(f) {
return function () {
if (!this._cache) {
this._cache = Object.create(null);
}
var cache = this._cache;
var k = arguments.length - 1;
for (var i = 0; i < k; i++) {
if (!(arguments[i] in cache)) {
cache[arguments[i]] = Object.create(null);