Finds a value referenced by a dot-chained property tree, i.e.:
import { dotProp } from '@amjs/js-utils';const ref: Record<string, any> = { key: { param: 'value' } };console.log(dotProp(ref, 'key.param')); // 'value' Copy
import { dotProp } from '@amjs/js-utils';const ref: Record<string, any> = { key: { param: 'value' } };console.log(dotProp(ref, 'key.param')); // 'value'
Can also modify the value within the reference if third argument is passed, i.e.:
dotProp(ref, 'key.param', 'foo');console.log(ref.key.param); // 'foo' Copy
dotProp(ref, 'key.param', 'foo');console.log(ref.key.param); // 'foo'
Where to find the property
Dot-chained tree property
Optional
New value to assign
Current value of the property
Finds a value referenced by a dot-chained property tree, i.e.:
Can also modify the value within the reference if third argument is passed, i.e.: