import { patch } from "https://deno.land/x/rimbu@0.10.0/mod.ts";
Returns an updated version of given value
, without modifying the value, where the contents
are updated according to the given patches
Patch array.
Examples
Example 1
Example 1
patch({ g: { h: 5 }})({ g: { h: 6 }}) // => { g: { h: 6 }}
patch({ g: { h: 5 }})({ g: { h: v => v + 1 }}) // => { g: { h: 6 }}
patch({ g: { h: 5 }})({ g: { h: 1 }}, { g: { h: v => v + 1 }})
// => { g: { h: 2 }}
patch({ a: 1, b: 3 })({ a: (v, p) => v * p.b, (v, p) => v + p.a })
// => { a: 3, b: 4 }
Returns
(...patches: Patch.Multi<T>) => T