@feugene/mu
Version:
Helpful TS utilities without dependencies
14 lines • 886 B
TypeScript
/**
* Build or update a nested object structure by a string path.
*
* Security: forbidden keys ("__proto__", "prototype", "constructor") are ignored to prevent prototype pollution.
*
* @param paths Path string, e.g. `"a.b.c"`. If empty, the original object is returned.
* @param value Value to set at the terminal key (default: `null`).
* @param object Target object to modify (mutates this object as per existing API).
* @param divider Path segment divider (default: `'.'`).
* @param replaceOnExist Replace existing keys along the path (default: `true`).
* @returns The same `object` reference with the path set (if valid).
*/
export default function pathToObject(paths?: string, value?: any, object?: Record<PropertyKey, any>, divider?: string, replaceOnExist?: boolean): Record<PropertyKey, any>;
//# sourceMappingURL=pathToObject.d.ts.map