mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-13 20:37:48 +00:00
Remove handling of function queue values from wrapperValueOf.
This commit is contained in:
31
lodash.js
31
lodash.js
@@ -4589,18 +4589,13 @@
|
|||||||
result = this.__wrapped__;
|
result = this.__wrapped__;
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
var data = queue[index],
|
var args = [result],
|
||||||
methodName = data[0];
|
data = queue[index],
|
||||||
|
methodName = data[0],
|
||||||
|
object = data[1];
|
||||||
|
|
||||||
if (typeof methodName == 'function') {
|
push.apply(args, data[2]);
|
||||||
result = methodName.apply(result, data[2]);
|
result = object[methodName].apply(object, args);
|
||||||
} else {
|
|
||||||
var args = [result],
|
|
||||||
object = data[1];
|
|
||||||
|
|
||||||
push.apply(args, data[2]);
|
|
||||||
result = object[methodName].apply(object, args);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -9640,8 +9635,8 @@
|
|||||||
if (!this.__chain__) {
|
if (!this.__chain__) {
|
||||||
return func.apply(this.value(), args);
|
return func.apply(this.value(), args);
|
||||||
}
|
}
|
||||||
return this.tap(function(value) {
|
return this.thru(function(value) {
|
||||||
func.apply(value, args);
|
return func.apply(value, args);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@@ -9649,11 +9644,11 @@
|
|||||||
// add `Array` functions that return wrapped value
|
// add `Array` functions that return wrapped value
|
||||||
arrayEach(['concat', 'push', 'reverse', 'sort', 'splice', 'unshift'], function(methodName) {
|
arrayEach(['concat', 'push', 'reverse', 'sort', 'splice', 'unshift'], function(methodName) {
|
||||||
var func = arrayProto[methodName],
|
var func = arrayProto[methodName],
|
||||||
retVal = methodName == 'concat' || methodName == 'splice';
|
chainName = (methodName == 'concat' || methodName == 'splice') ? 'thru' : 'tap';
|
||||||
|
|
||||||
lodash.prototype[methodName] = function() {
|
lodash.prototype[methodName] = function() {
|
||||||
var args = arguments;
|
var args = arguments;
|
||||||
return this[retVal ? 'thru' : 'tap'](function(value) {
|
return this[chainName](function(value) {
|
||||||
return func.apply(value, args);
|
return func.apply(value, args);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -9664,7 +9659,7 @@
|
|||||||
if (!support.spliceObjects) {
|
if (!support.spliceObjects) {
|
||||||
arrayEach(['pop', 'shift', 'splice'], function(methodName) {
|
arrayEach(['pop', 'shift', 'splice'], function(methodName) {
|
||||||
var func = arrayProto[methodName],
|
var func = arrayProto[methodName],
|
||||||
isSplice = methodName == 'splice';
|
notSplice = methodName != 'splice';
|
||||||
|
|
||||||
function wrapper(value, args) {
|
function wrapper(value, args) {
|
||||||
var result = func.apply(value, args);
|
var result = func.apply(value, args);
|
||||||
@@ -9675,10 +9670,10 @@
|
|||||||
}
|
}
|
||||||
lodash.prototype[methodName] = function() {
|
lodash.prototype[methodName] = function() {
|
||||||
var args = arguments;
|
var args = arguments;
|
||||||
if (!this.__chain__ && !isSplice) {
|
if (notSplice && !this.__chain__) {
|
||||||
return wrapper(this.value(), args);
|
return wrapper(this.value(), args);
|
||||||
}
|
}
|
||||||
return this[isSplice ? 'thru' : 'tap'](function(value) {
|
return this.thru(function(value) {
|
||||||
return wrapper(value, args);
|
return wrapper(value, args);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user