nhb-toolbox
Version:
A versatile collection of smart, efficient, and reusable utility functions, classes and types for everyday development needs.
18 lines (17 loc) • 695 B
TypeScript
/**
* Safely resolves nested keys from a dot-separated string like "user.city".
*
* @param obj - The source object
* @param path - The nested path string (e.g. "user.city")
* @returns The resolved value or `undefined`
*/
export declare function _resolveNestedKey(obj: unknown, path: string): unknown;
/**
* Retrieves a numeric value from a nested property in dot notation.
* Falls back to 0 if value is not a number or numeric string.
*
* @param obj - The source object to read from.
* @param path - The path string like 'user.income.tax'.
* @returns The numeric value at that path, or 0 if not valid.
*/
export declare function _getNumericProp(obj: unknown, path: string): number;