mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 09:47:48 +00:00
Ensure _.first and _.last have the correct chaining behavior when passing a callback and thisArg.
Former-commit-id: 4d54fd677fa48bf8de033696c58ee66babd77a81
This commit is contained in:
@@ -4542,9 +4542,11 @@
|
||||
|
||||
forOwn(lodash, function(func, methodName) {
|
||||
if (!lodash.prototype[methodName]) {
|
||||
lodash.prototype[methodName]= function(n, guard) {
|
||||
var result = func(this.__wrapped__, n, guard);
|
||||
return (n == null || guard) ? result : new lodash(result);
|
||||
lodash.prototype[methodName]= function(callback, thisArg) {
|
||||
var result = func(this.__wrapped__, callback, thisArg);
|
||||
return callback == null || (thisArg && typeof callback != 'function')
|
||||
? result
|
||||
: new lodash(result);
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user