Closed ghost1542 closed 7 years ago
Tests appear to be passing on travis, seems like it is getting some configuration error after running them.
Zuul tried to run tests in saucelabs, however no saucelabs credentials were provided.
@rtfeldman Bump, just checking if there is any chance this can be included in the library :-) I'm around if you have any comments.
Seems reasonable, and deep-equals
seems like a trivially small dependency to add.
If you wouldn't mind resolving the merge conflicts, I'd be happy to merge this!
@rtfeldman Just rebased with support for static methods in tests and .replace. Should be good to go.
Seems reasonable, and deep-equals seems like a trivially small dependency to add.
Yup and actually it's only a devDependency for test units. It is not used in the actual seamless-immutable code (tried to keep it as optimized as possible).
This feature is helpful to leverage the usefulness of immutable objects when they need to be refreshed from external data. Typical example is refreshing immutable data from an API call, and have pure React components watching for granular changes in those objects.
obj.merge(data, {deep: true})
almost provides the desired behavior, except that deprecated object keys from previous immutable objects can pollute new objects, and lead to unexpected behavior.This pull request addresses this use case by allowing the use of
{deep: true}
on.set
and.setIn
and a new.replace()
method. When using those, merge() is used to merge mergeable objects, with an extra{mode: 'replace'}
parameter to delete deprecated keys on the new object.The feature was not implemented for
.update
and.updateIn
in the expectation that custom functions can handle deep merge and granular changes themselves in a faster fashion.This pull request also includes test units (ran extensively) and fixes some edge cases with NaN, as well as updating lodash to fix bugs where it was at fault.
Performances for deep .merge() should be unchanged, deep replace is obviously expected to be a bit slower than normal merge, tested with code below.
Thank you for this fantastic immutable library :-)