_.merge callback not applied to nested properties. #227

Closed
jgrund opened this Issue Apr 1, 2013 · 1 comment

2 participants

@jgrund

Consider:

var food = {
  fruits: {
    fruitList: ['apple', 'pear']
  },
  vegetables: ['beet'],
};

var otherFood = {
  fruits: {
    fruitList: ['banana']
  },
  'vegetables': ['carrot']
};

lodash.merge(food, otherFood, function(a, b) {
  return _.isArray(a) ? a.concat(b) : undefined;
});

The result is:

{
  fruits: {
    fruitList: ['apple', 'pear']
  },
  "vegetables": ['beet', 'carrot']
}

The top level array has been merged, but the nested fruitList has not.

@jdalton jdalton closed this in 68fcc30 Apr 2, 2013
@jdalton
Lodash Utilities member

I'll bump a v1.1.2 in the couple of days or so.

@jdalton jdalton added a commit that referenced this issue Aug 29, 2013
@jdalton jdalton Ensure `_.merge` applies a given `callback` to nested properties. [cl…
…oses #227]

Former-commit-id: 1a58c178e0ecb9c50512f221b4aed82762709066
9742d18
@jdalton jdalton added a commit that referenced this issue Sep 1, 2013
@jdalton jdalton Ensure `_.merge` applies a given `callback` to nested properties. [cl…
…oses #227]

Former-commit-id: 1a58c178e0ecb9c50512f221b4aed82762709066
dbf95cf
@jdalton jdalton added a commit that referenced this issue Sep 25, 2014
@jdalton jdalton Ensure `_.merge` applies a given `callback` to nested properties. [cl…
…oses #227]

Former-commit-id: 1a58c178e0ecb9c50512f221b4aed82762709066
b0d942d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment