path-value
Version:
Property path-to-value resolver, in TypeScript
28 lines (27 loc) • 1.03 kB
TypeScript
import { IPathOptions, IPathResult, PathInput } from './types';
/**
* Path-to-descriptor core resolution function.
*
* @param target
* Default resolution scope.
*
* @param path
* Resolution path, either as an array of property names, or a dot-separated string.
* If the path starts with `this`, resolution is against the calling context.
*
* @param options
* Path-parsing options.
*/
export declare function resolvePath(this: any, target: any, path: PathInput, options?: IPathOptions): IPathResult;
/**
* Converts a valid full-syntax JavaScript string into an array of names/indexes,
* which then can be passed into `resolvePath`.
*
* This function is separate from `resolvePath` for performance reasons, as tokenizing
* a path is much slower than resolving a tokenized path. Therefore, when possible, it is
* best to tokenize a path only once, and then reuse the tokens to resolve the path value.
*
* @param path
* Valid JavaScript property path.
*/
export declare function tokenizePath(path: string): string[];