import { Deep } from "https://deno.land/x/rimbu@1.2.0/deep/mod.ts";
const { patchAtWith } = Deep;
Returns a function that patches a given value
with the given patchItems
at the given path
.
Examples
Example 1
Example 1
const items = [{ a: { b: 1, c: 'a' } }, { a: { b: 2, c: 'b' } }];
items.map(Deep.patchAtWith('a', [{ b: (v) => v + 1 }]));
// => [{ a: { b: 2, c: 'a' } }, { a: { b: 3, c: 'b' } }]
Parameters
path: P
- the string path in the object
patchItem: Patch<Path.Result<TE, P>, Path.Result<TT, P>>
- the
Patch
definition to update the value at the givenpath
inT
with.