import { Deep } from "https://deno.land/x/rimbu@0.13.5/deep/internal.ts";
const { patchAt } = Deep;
Patches the value at the given path in the source to the given value.
Because the path to update must exist in the source
object, optional
chaining and array indexing is not allowed.
Examples
Example 1
Example 1
const value = { a: { b: { c: 5 } } };
Deep.patchAt(value, 'a.b.c', v => v + 5);
// => { a: { b: { c: 6 } } }
Parameters
source: T
- the object to update
path: P
- the path in the object to update
patchItem: Patch<Path.Result<T, P>, Path.Result<T, P> & C>
- the patch for the value at the given path