Skip to main content
Module

x/rimbu/mod.ts>Deep.patchWith

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
function Deep.patchWith
import { Deep } from "https://deno.land/x/rimbu@0.14.0/mod.ts";
const { patchWith } = Deep;

Returns a function that patches a given source with the given patchItems.

Examples

Example 1

const items = [{ a: 1, b: 'a' }, { a: 2, b: 'b' }];
items.map(Deep.patchWith([{ a: v => v + 1 }]));
// => [{ a: 2, b: 'a' }, { a: 3, b: 'b' }]

Type Parameters

T
optional
TE extends T = T
optional
TT = T

Parameters

patchItem: Patch<TT, TE>
  • the Patch definition to update the given value of type T with.

Returns

(source: TE) => T