UNPKG

web-ui-pack

Version:
23 lines (22 loc) 1.04 kB
declare const nestedProperty: { /** * Sets the value at path of object. If a portion of path doesn’t exist it’s created. * nestedProperty.set(obj, "value.nestedValue", 1) as obj.value.nestedValue = 1; * @param object The object to modify. * @param path The path of the property to set. * @param value The value to set. */ set<T extends Record<string, any>>(obj: T, path: string, value: any): void; /** * Gets the property value at path of object. * nestedProperty.get(obj, "nestedValue1.nestVal2") returns value from obj.nestedValue1.nestVal2 * @param object The object to query. * @param path The path of the property to get. * @param out output object. Point empty {} if you want to get extrachecking hasProp (to define if prop undefined and exists) * @return Returns the resolved value. */ get<TObj extends Record<string, any>, TVal>(obj: TObj, path: string, out?: { hasProp?: boolean; }): TVal | undefined; }; export default nestedProperty;