Fix arguments resolution in weak length=1 version

This commit is contained in:
Mariusz Nowak
2015-09-17 21:30:16 +02:00
parent 4e310f91bb
commit ab7044f32c

View File

@@ -36,10 +36,11 @@ module.exports = function (memoize) {
!(options.dispose && extensions.dispose) && !(options.maxAge && extensions.maxAge) &&
!(options.max && extensions.max) && !(options.refCounter && extensions.refCounter)) {
return defineProperties(function (obj) {
var result;
if (resolve) obj = resolve(arguments)[0];
var result, args = arguments;
if (resolve) args = resolve(args);
obj = args[0];
if (map.has(obj)) return map.get(obj);
result = fn.call(this, obj);
result = fn.apply(this, args);
if (map.has(obj)) throw customError("Circular invocation", 'CIRCULAR_INVOCATION');
map.set(obj, result);
return result;