Skip to content

Function: setProperty()

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

Defined in: utils.ts:44

Sets a property in an object based on a path.

Type Parameters

T

T

Parameters

obj

any

The object to update.

path

The path to the property (e.g., "key" or ["user", "name"]).

string[] | "*" | keyof T

value

any

The new value to set at the specified path.

Returns

T

The updated object.

Released under the MIT License.