Skip to content

toolmark-monorepo / @toolmark/core / setPath

Function: setPath() ​

setPath<T>(obj, path, value): T

Defined in: packages/core/src/forms/paths.ts:245

Returns a copy of obj with path set to value (copying each container along the path; missing or non-object intermediates become plain objects).

Type Parameters ​

T ​

T

Parameters ​

obj ​

T

Source value (not mutated).

path ​

string

Dot path.

value ​

unknown

Value to set.

Returns ​

T

The updated copy.

Throws ​

ToolmarkError invalid_path for an empty segment or a prototype key.