/** * Safely retrieves a nested property value from an object using a dot-notation path. * Returns a default value if the property doesn't exist or any part of the path is invalid. * * @param obj - The source object to retrieve the value from. * @param path - A dot-notation string representing the property path (e.g., 'user.address.city'). * @param defaultValue - The value to return if the path cannot be resolved (default: undefined). * @returns The value at the specified path or the default value if not found. * * @example * // Basic nested property access * const user = { name: 'John', address: { city: 'New York', zip: 10001 } }; * safeGet(user, 'address.city'); // 'New York' * safeGet(user, 'name'); // 'John' * * @example * // Deep nesting * const data = { a: { b: { c: { d: 'value' } } } }; * safeGet(data, 'a.b.c.d'); // 'value' * * @example * // Non-existent paths return default * safeGet(user, 'address.country', 'USA'); // 'USA' (default) * safeGet(user, 'phone.mobile'); // undefined * safeGet(user, 'settings.theme', 'dark'); // 'dark' * * @example * // Empty path returns entire object * safeGet(user, ''); // { name: 'John', address: { city: 'New York', zip: 10001 } } * * @example * // Top-level property with dots in key name * const obj = { 'user.name': 'Alice', user: { name: 'Bob' } }; * safeGet(obj, 'user.name'); // 'Alice' (exact key match has priority) * * @note Returns default value if any segment of the path doesn't exist or is null/undefined. * @note Only supports dot notation (e.g., 'a.b.c'); does NOT handle array indices (e.g., 'items[0]'). * @note If the path exactly matches a top-level key, returns that value directly. * @note Empty string segments in path (e.g., 'a..b') return the default value. * @note Useful for safely accessing configuration, API responses, or user data. * * @complexity Time: O(n) where n is the depth of the path, Space: O(1) */ export declare function safeGet, D>(obj: T, path: string, defaultValue?: D): D | unknown; //# sourceMappingURL=safeGet.d.ts.map