From 54a0de9b521ac44fceb9e9a22b312fff2f09f50e Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 28 Apr 2014 08:31:54 -0700 Subject: [PATCH] Make `_.merge` align with `_.assign` exit early snippet. --- lodash.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lodash.js b/lodash.js index 84636cf14..d0cd18109 100644 --- a/lodash.js +++ b/lodash.js @@ -6760,13 +6760,13 @@ * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot] } */ function merge(object, source, guard) { - if (!object) { - return object; - } var args = arguments, length = args.length, type = typeof guard; + if (!object || length < 2) { + return object; + } // enables use as a callback for functions like `_.reduce` if ((type == 'number' || type == 'string') && args[3] && args[3][guard] === source) { length = 2;