Fix test fails in Safari.

This commit is contained in:
John-David Dalton
2016-03-20 01:02:53 -07:00
parent 984bcc556e
commit 6494a072d2

View File

@@ -15441,23 +15441,16 @@
arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
var func = arrayProto[methodName],
chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
mutates = methodName != 'sort',
retUnwrapped = /^(?:pop|shift)$/.test(methodName);
lodash.prototype[methodName] = function() {
var args = arguments;
if (retUnwrapped && !this.__chain__) {
var value = this.value();
if ((mutates ? !isArray(value) : (value == null))) {
value = [];
}
return func.apply(value, args);
return func.apply(isArray(value) ? value : [], args);
}
return this[chainName](function(value) {
if ((mutates ? !isArray(value) : (value == null))) {
value = [];
}
return func.apply(value, args);
return func.apply(isArray(value) ? value : [], args);
});
};
});