mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 02:17:48 +00:00
Make _.memoize skip the __proto__ key.
This commit is contained in:
@@ -5340,9 +5340,11 @@
|
||||
throw new TypeError(funcErrorText);
|
||||
}
|
||||
var memoized = function() {
|
||||
var cache = memoized.cache,
|
||||
key = resolver ? resolver.apply(this, arguments) : '_' + arguments[0];
|
||||
|
||||
var key = resolver ? resolver.apply(this, arguments) : arguments[0];
|
||||
if (key == '__proto__') {
|
||||
return func.apply(this, arguments);
|
||||
}
|
||||
var cache = memoized.cache;
|
||||
return hasOwnProperty.call(cache, key)
|
||||
? cache[key]
|
||||
: (cache[key] = func.apply(this, arguments));
|
||||
|
||||
Reference in New Issue
Block a user