diff --git a/lodash.js b/lodash.js index 0586c68e8..c80920650 100644 --- a/lodash.js +++ b/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); }); }; });