merge-change
Version:
Advanced library for deep merging, patching, and immutable updates of data structures. Features declarative operations for specific merging behaviors, property management, custom type merging rules, and difference tracking. Supports complex data transform
13 lines (12 loc) • 718 B
TypeScript
import type { FlatObject } from './types';
/**
* Converting a nested structure to a flat one
* Property names are transformed into a path {a: {b: 0}} => {'a.b': 0}
* @param value {object|*} Source objects for conversion
* @param separator
* @param [path] {string} Base path for forming keys of the flat object. Used for recursion.
* @param [clearUndefined] {boolean} Flag indicating whether to add undefined values to the result
* @param [result] {object} Result - flat object. Passed by reference for recursion
* @returns {{}}
*/
export declare function flat<V, S extends string = '.', P extends string = '', R = FlatObject<V, S>>(value: V, separator?: S, clearUndefined?: boolean, path?: P, result?: R): R;