updeep/lib/in.js
Aaron Jensen 5c0855b9df Add u.is
2015-08-06 20:48:04 -07:00

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);