@threadplane/a2uiFunctionv0.3.4

setByPointer

Returns a new model with value written at pointer.

The input model is not mutated. Missing intermediate objects are created.

import { setByPointer } from '@threadplane/a2ui';

Declaration · overload 1

export declare function setByPointer(model: Record<string, unknown>, pointer: string, value: unknown): Record<string, unknown>;

Parameters

model · required
Record<string, unknown>
pointer · required
string
value · required
unknown

Returns

Record<string, unknown>

Examples

const next = setByPointer({}, '/user/name', 'Ada');