mobx-bonsai
Version:
A fast lightweight alternative to MobX-State-Tree + Y.js two-way binding
16 lines (15 loc) • 480 B
TypeScript
/**
* Tries to resolve a path from an object.
*
* @template T Returned value type.
* @param pathRootNode Node that serves as path root.
* @param path Path as an string or number array.
* @returns An object with `{ resolved: true, value: T }` or `{ resolved: false }`.
*/
export declare function resolvePath<T extends object>(pathRootNode: object, path: readonly (string | number)[]): {
resolved: true;
value: T;
} | {
resolved: false;
value?: undefined;
};