mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 23:37:49 +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) {
|
||||
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);
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user