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

x/rimbu/deep/patch.ts

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
import * as rimbu from "https://deno.land/x/rimbu@1.0.4/deep/patch.ts";

Functions

Returns an immutably updated version of the given value where the given patchItems have been applied to the result. The Rimbu patch notation is as follows:

  • if the target is a simple value or array, the patch can be the same type or a function returning the same type
  • if the target is a tuple (array of fixed length), the patch be the same type or an object containing numeric keys with patches indicating the tuple index to patch
  • if the target is an object, the patch can be the same type, or an array containing partial keys with their patches for the object

Type Aliases

A type to determine the allowed input type for the patch function.

The entry type for a (nested) patch. Can be either a patch object or a function accepting the nested patch function and returning a patch object.

A function patch type that is a function taking the current value, the parent and root values, and returns a return value.

Utility type to exclude Iterable types.

A type defining the allowed patch values for objects.

A type defining the allowed patch values for object properties.

A type defining the allowed patch values for tuples.

Either result type S, or a patch function with the value type, the parent type, and the root type.