setProp

Function

Sets a deep object property, constructing the property path as necessary

  • setProp(path: string | string[], val: any, obj: any, replace: boolean) : void

Parameters

Parameter Type Default Notes
path Required string | string[]

the path to the property we want to set

val Required any

the value we want to set it to

obj Required any

the target object

replace Optional boolean false

if true, replace the value at the path with the new value instead of merging

Returns

void

Function defined in common/src/objects/set-prop.ts:11