UNPKG

staticql

Version:

Type-safe query engine for static content including Markdown, YAML, JSON, and more.

28 lines (27 loc) 1.15 kB
/** * Recursively unwraps a single-element array. * * @param value - Any value or array. * @returns The unwrapped value if the input is a single-element array; otherwise returns the input as-is. */ export declare function unwrapSingleArray(value: any): any; /** * Resolves a dot-notated field path from an object, returning the value as a array. * * If an intermediate path contains arrays, it will join stringified values with spaces. * * @param obj - The target object. * @param fieldPath - Dot-separated path (e.g., "a.b.c"). * @returns A string value or `undefined` if the path is invalid. */ export declare function resolveField(obj: any, fieldPath: string): string[]; /** * Extracts all nested property values for a given path from an object or array of objects. * * Used for recursive property traversal when resolving relations or indexing. * * @param objOrArray - The input object or array of objects. * @param path - An array of property keys (e.g., ['a', 'b']). * @returns A flat array of all extracted values along the path. */ export declare function extractNestedProperty(objOrArray: any, path: string[]): any[];