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
12 lines (11 loc) • 702 B
TypeScript
import { ExtractPathsAny, PathToType } from '../common-types/types';
/**
* Sets a value at the specified path. If the path is not found in obj, the corresponding property will be created
* @param obj - Object in which the value is set
* @param path - Path in the object where the value is set
* @param value - Value to be set
* @param skipExisting - If true, do not replace existing values (set only if absent)
* @param separator - Separator in a property path
* @returns Previous value at the specified path
*/
export declare function set<D, P extends ExtractPathsAny<D, S>, S extends string = '.'>(obj: D, path: P, value: unknown, skipExisting?: boolean, separator?: S): PathToType<D, P, S>;