333ca47cfd
With u.if and u.is, it was too confusing. Originally I thought that because u stood for update, it would make sense, but as I add more functions, I think that was wrong.
13 lines
337 B
JavaScript
13 lines
337 B
JavaScript
import curry from 'lodash/function/curry';
|
|
import update from './update';
|
|
import splitPath from './util/splitPath';
|
|
|
|
function updateIn(path, value, object) {
|
|
const parts = splitPath(path);
|
|
const updates = parts.reduceRight((acc, key) => ({ [key]: acc }), value);
|
|
|
|
return update(updates, object);
|
|
}
|
|
|
|
export default curry(updateIn);
|