mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 02:47:50 +00:00
Make _.merge align with _.assign exit early snippet.
This commit is contained in:
@@ -6760,13 +6760,13 @@
|
|||||||
* // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot] }
|
* // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot] }
|
||||||
*/
|
*/
|
||||||
function merge(object, source, guard) {
|
function merge(object, source, guard) {
|
||||||
if (!object) {
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
var args = arguments,
|
var args = arguments,
|
||||||
length = args.length,
|
length = args.length,
|
||||||
type = typeof guard;
|
type = typeof guard;
|
||||||
|
|
||||||
|
if (!object || length < 2) {
|
||||||
|
return object;
|
||||||
|
}
|
||||||
// enables use as a callback for functions like `_.reduce`
|
// enables use as a callback for functions like `_.reduce`
|
||||||
if ((type == 'number' || type == 'string') && args[3] && args[3][guard] === source) {
|
if ((type == 'number' || type == 'string') && args[3] && args[3][guard] === source) {
|
||||||
length = 2;
|
length = 2;
|
||||||
|
|||||||
Reference in New Issue
Block a user