Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace lodash/merge with a very simple deep merge #1288

Merged
merged 1 commit into from Jul 6, 2019

Conversation

KidkArolis
Copy link
Contributor

This is by no means an equivalent function, but I'm just wondering - isn't this enough?

In fact, maybe the updateProxyById code could be restructured to avoid the need to deep merge in the first place? I'm not familiar with the code enough to know if this merge replacement is sufficient to merge renderOptions and componentOptions.

Note, even arrays are merged differently using this code:

var object = {
  'a': [{ 'b': 2 }, { 'd': 4 }]
};
 
var other = {
  'a': [{ 'c': 3 }, { 'e': 5 }]
};
 
_.merge(object, other);
// => positional merge { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }

merge(object, other);
// => concat the arrays { 'a': [{ 'b': 2, 'd': 4, 'c': 3, 'e': 5 }] }

Fix #1269

@KidkArolis
Copy link
Contributor Author

Reading the comments further in #1269, I'll see if I can remove merge entirely..

@theKashey theKashey merged commit 2f8b933 into gaearon:master Jul 6, 2019
@theKashey
Copy link
Collaborator

:killitwithfire:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using lodash-es
3 participants