UNPKG

flowmolio

Version:

[![Tests](https://github.com/vladvlasov256/flowmolio/actions/workflows/test.yml/badge.svg)](https://github.com/vladvlasov256/flowmolio/actions/workflows/test.yml) [![Coverage](https://codecov.io/gh/vladvlasov256/flowmolio/branch/main/graph/badge.svg)](htt

18 lines (17 loc) 693 B
import { JSONValue } from '../types'; /** * Extracts a value from a nested object using a dot-notation path. * Supports both object properties and array indices. * * @param obj - The source object to extract from * @param path - Dot-notation path (e.g., "user.name", "items.0", "users.1.email") * @returns The value at the specified path, or undefined if not found * * @example * ```typescript * const data = { users: [{ name: 'John' }, { name: 'Jane' }] } * getValueFromPath(data, 'users.0.name') // Returns 'John' * getValueFromPath(data, 'users.1.name') // Returns 'Jane' * ``` */ export declare function getValueFromPath(obj: JSONValue, path: string): JSONValue | undefined;