Module

x/rambda/immutable.d.ts>assoc

Faster and smaller alternative to Ramda
Latest
function assoc
import { assoc } from "https://dotland.deno.dev/x/rambda@9.4.1/immutable.d.ts";

It makes a shallow clone of obj with setting or overriding the property prop with newValue.

Type Parameters

K extends PropertyKey

Returns

{ <T>(val: T): <U extends Record<K, T>>(obj: U) => U; <U extends Record<K, T>, T>(val: T, obj: U): U; }

Type Parameters

T
K extends PropertyKey

Parameters

prop: K
val: T

Returns

{ <U>(obj: U): U extends Record<K, any> ? U[K] extends T ? U : Record<K, T> & Omit<U, K> : U & Record<K, T>; }

Type Parameters

U
K extends keyof U
T extends U[K]

Parameters

prop: K
val: T
obj: U