updeep-remeda/lib/updateIn.js
Aaron Jensen 3ce001a4f6 Replace lodash curry with our own
lodash's curry is great and does a lot, but we don't need it all. This
is quite a bit faster.

Currently, it does away with placeholder support.

updeep curry partial call x 9,951,410 ops/sec ±1.61% (62 runs sampled)
lodash curry partial call x 988,949 ops/sec ±1.36% (62 runs sampled)
2015-08-11 23:58:54 -07:00

13 lines
328 B
JavaScript

import curry from './util/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);