parent
e53aa11b27
commit
c083f4a330
@ -1,5 +1,10 @@
|
||||
# Change Log
|
||||
|
||||
## [unreleased]
|
||||
|
||||
## [0.7.1]
|
||||
* Fix update omitting empty object. (https://github.com/substantial/updeep/issues/29)
|
||||
|
||||
## [0.7.0]
|
||||
* Add `u._` placeholder for curried functions.
|
||||
* Add `u.constant` for replacing an object outright. (https://github.com/substantial/updeep/issues/10)
|
||||
@ -60,7 +65,8 @@
|
||||
## 0.1.0
|
||||
* Initial release
|
||||
|
||||
[unreleased]: https://github.com/aaronjensen/updeep/compare/v0.7.0...HEAD
|
||||
[unreleased]: https://github.com/aaronjensen/updeep/compare/v0.7.1...HEAD
|
||||
[0.7.1]: https://github.com/aaronjensen/updeep/compare/v0.7.0...v0.7.1
|
||||
[0.7.0]: https://github.com/aaronjensen/updeep/compare/v0.6.0...v0.7.0
|
||||
[0.6.0]: https://github.com/aaronjensen/updeep/compare/v0.5.0...v0.6.0
|
||||
[0.5.0]: https://github.com/aaronjensen/updeep/compare/v0.4.0...v0.5.0
|
||||
|
@ -69,7 +69,7 @@ function update(updates, object, ...args) {
|
||||
const resolvedUpdates = resolveUpdates(updates, defaultedObject);
|
||||
|
||||
if (isEmpty(resolvedUpdates)) {
|
||||
return object;
|
||||
return defaultedObject;
|
||||
}
|
||||
|
||||
if (Array.isArray(defaultedObject)) {
|
||||
|
@ -129,4 +129,9 @@ describe('updeep', () => {
|
||||
result = u({ a: { b: 0 } }, { });
|
||||
expect(result).toEqual({ a: { b: 0 } });
|
||||
});
|
||||
|
||||
it('preserves empty objects when empty updates are specified', () => {
|
||||
const result = u({ a: {} }, {});
|
||||
expect(result).toEqual({ a: {} });
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user