mesh-fetcher
Version:
A Node.js package for fetching data from multiple APIs with enhanced features.
23 lines (22 loc) • 707 B
TypeScript
import { FlattenOptions } from '../types';
/**
* Flattens a nested object structure into a single-level object with dot-notation keys.
*
* @template T - The type of the object to flatten
* @param {T} obj - The object to flatten
* @param {FlattenOptions} [options] - Options for flattening behavior
* @returns {Record<string, unknown>} A flattened object
*
* @example
* ```typescript
* const obj = {
* user: {
* name: 'John',
* address: { city: 'NY' }
* }
* };
* const flat = flattenObject(obj);
* // { 'user.name': 'John', 'user.address.city': 'NY' }
* ```
*/
export declare function flattenObject<T extends object>(obj: T, options?: FlattenOptions): Record<string, unknown>;