UNPKG

dbl-utils

Version:

Utilities for dbl, adba and others projects

29 lines (28 loc) 978 B
/** * Type definition for the options parameter */ type FlatCopyOptions = { delimiter?: string; ommit?: string[]; ommitArrays?: boolean; prefix?: string; ommitFn?: (key: string, value: any, newIndex: string) => boolean; }; /** * Flattens an object into a single-level object with delimited keys. * * @param object - The object to flatten * @param options - Configuration options for flattening * @returns A single-level object with flattened keys * @throws Will throw an error if the input is not an object */ export declare function flatten(object: object, options?: FlatCopyOptions): Record<string, any>; /** * Reverts a flattened object back to its nested structure, with support for arrays. * * @param object - The object to unflatten * @param delimiter - The delimiter used to flatten the object * @returns A nested object or array */ export declare function unflatten(object: Record<string, any>, delimiter?: string): object; export {};