From 6494a072d2d9937e9e322aa375cc9328d910c651 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 20 Mar 2016 01:02:53 -0700 Subject: [PATCH] Fix test fails in Safari. --- lodash.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) 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); }); }; });