parent
c7592a26b4
commit
08ebbf5c89
@ -1,6 +1,7 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
## [unreleased]
|
## [unreleased]
|
||||||
|
* Fix cannot update value to null (https://github.com/substantial/updeep/issues/8)
|
||||||
* Add umd distribution builds via webpack. (https://github.com/aaronjensen/updeep/issues/3)
|
* Add umd distribution builds via webpack. (https://github.com/aaronjensen/updeep/issues/3)
|
||||||
|
|
||||||
## [0.2.2]
|
## [0.2.2]
|
||||||
|
@ -5,7 +5,7 @@ import assign from 'lodash/object/assign';
|
|||||||
function resolveUpdates(updates, obj = {}) {
|
function resolveUpdates(updates, obj = {}) {
|
||||||
return reduce(updates, (acc, value, key) => {
|
return reduce(updates, (acc, value, key) => {
|
||||||
let updatedValue = value;
|
let updatedValue = value;
|
||||||
if (!Array.isArray(value) && typeof value === 'object') {
|
if (!Array.isArray(value) && value !== null && typeof value === 'object') {
|
||||||
updatedValue = update(value, obj[key]);
|
updatedValue = update(value, obj[key]);
|
||||||
} else if (typeof value === 'function') {
|
} else if (typeof value === 'function') {
|
||||||
updatedValue = value(obj[key]);
|
updatedValue = value(obj[key]);
|
||||||
|
@ -109,4 +109,8 @@ describe('updeep', () => {
|
|||||||
expect(Object.isFrozen(result)).to.be.true;
|
expect(Object.isFrozen(result)).to.be.true;
|
||||||
expect(Object.isFrozen(result.foo)).to.be.true;
|
expect(Object.isFrozen(result.foo)).to.be.true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('assigns null values', () => {
|
||||||
|
expect(u({isNull: null}, {})).to.eql({isNull: null});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user