mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 02:17:50 +00:00
Fix test fails in Safari.
This commit is contained in:
11
lodash.js
11
lodash.js
@@ -15441,23 +15441,16 @@
|
|||||||
arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
|
arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
|
||||||
var func = arrayProto[methodName],
|
var func = arrayProto[methodName],
|
||||||
chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
|
chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
|
||||||
mutates = methodName != 'sort',
|
|
||||||
retUnwrapped = /^(?:pop|shift)$/.test(methodName);
|
retUnwrapped = /^(?:pop|shift)$/.test(methodName);
|
||||||
|
|
||||||
lodash.prototype[methodName] = function() {
|
lodash.prototype[methodName] = function() {
|
||||||
var args = arguments;
|
var args = arguments;
|
||||||
if (retUnwrapped && !this.__chain__) {
|
if (retUnwrapped && !this.__chain__) {
|
||||||
var value = this.value();
|
var value = this.value();
|
||||||
if ((mutates ? !isArray(value) : (value == null))) {
|
return func.apply(isArray(value) ? value : [], args);
|
||||||
value = [];
|
|
||||||
}
|
|
||||||
return func.apply(value, args);
|
|
||||||
}
|
}
|
||||||
return this[chainName](function(value) {
|
return this[chainName](function(value) {
|
||||||
if ((mutates ? !isArray(value) : (value == null))) {
|
return func.apply(isArray(value) ? value : [], args);
|
||||||
value = [];
|
|
||||||
}
|
|
||||||
return func.apply(value, args);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user