Closed ctate closed 9 years ago
This module needs to retain the algorithm from jQuery, and as such, no new features like this can ever be added.
In addition, I recommend using a distinct module for a different purpose - if we weren't conforming to jQuery's API, we wouldn't have a "deep" argument, we'd have two different functions, assign
(since the language has Object.assign
for this now) and deepAssign
.
Thanks for your contribution though!
Hi all - I've used this module for a while now and have often needed the ability to combine arrays in a deep merge (instead of replacing array elements by index).
I tried to keep the code/syntax style the same by simply adding a second boolean argument to enable this feature:
All of the current tests pass and I'm willing to write more tests if needed. This feature only applies to plain arrays (arrays of strings or numbers only) and sorts the array once combined.
I hope others find this useful. Please consider this PR and/or provide feedback if you'd like to see a different implementation.
Thank you for your time and consideration!