@threadplane/a2uiFunctionv0.3.4

getByPointer

Reads a value from a model using the package's simple slash-separated pointer syntax.

Empty string and / target the root. Segments are not RFC 6901-unescaped; normalize keys before using pointers that would require ~0 or ~1.

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

Declaration · overload 1

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

Parameters

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

Returns

unknown

Examples

getByPointer({ user: { name: 'Ada' } }, '/user/name'); // 'Ada'