Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/rimbu/deep/mod.ts>patchWith

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

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