Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
jgrund opened this Issue · 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
@jdalton
Owner

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

@jdalton jdalton referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@jdalton jdalton referenced this issue from a commit
@jdalton jdalton Ensure `_.merge` applies a given `callback` to nested properties. [cl…
…oses #227]

Former-commit-id: 1a58c178e0ecb9c50512f221b4aed82762709066
9742d18
@jdalton jdalton referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@jdalton jdalton referenced this issue from a commit
@jdalton jdalton Ensure `_.merge` applies a given `callback` to nested properties. [cl…
…oses #227]

Former-commit-id: 1a58c178e0ecb9c50512f221b4aed82762709066
dbf95cf
@jdalton jdalton referenced this issue from a commit
@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
Something went wrong with that request. Please try again.