bug fix for _.memoize when key is derived from prototype

This commit is contained in:
lifesinger
2011-01-17 14:57:02 +08:00
parent 52f66a807c
commit 840f19c102
2 changed files with 8 additions and 1 deletions

View File

@@ -426,7 +426,7 @@
hasher = hasher || _.identity;
return function() {
var key = hasher.apply(this, arguments);
return key in memo ? memo[key] : (memo[key] = func.apply(this, arguments));
return hasOwnProperty.call(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments));
};
};