UNPKG

attrpath

Version:
40 lines (39 loc) 1.22 kB
/** * Copyright © 2020 2021 2022 7thCode.(http://seventh-code.com/) * This software is released under the MIT License. * opensource.org/licenses/mit-license.php */ import { AttributeParser, FormulaParser } from './parser'; import { ParserStream } from './stream'; import { BaseHandler, ValueHandler } from './handler'; export { AttributeParser, FormulaParser, ParserStream, BaseHandler, ValueHandler }; /** * AttrPath */ export declare class AttrPath { /** * traverse * * @remarks * Traverse an object's attributes to get its value. * * @param target - Object * @param path - ObjectPath e.g. ".x.Y.z[1]" * @param default_value - The value to return if there is no corresponding value in the object path. default is "undefined" * @returns The value at the position of the path. * */ static traverse(target: any, path: string, default_value?: any): any; static update(target: any, path: string, value: any): boolean; /** * is_valid * * @remarks * Is the path grammatically correct? * * @param path - ObjectPath e.g. ".x.Y.z[1]" * @returns true/false * */ static is_valid(path: string): boolean; }