Function safeBatchSet
- safe
Batch (data, accessors, value, operation?, defaultAccessValue?, createMissing?): voidSet Parameters
- data: object
An object to access entry data.
- accessors: string[]
A string describing the entries to access.
- value: any
A new value to set if an entry for accessor is found.
Optional
operation: SafeSetOperationOperation to perform including: 'add', 'div', 'mult', 'set', 'set-undefined', 'sub'.
Optional
defaultAccessValue: anyA new value to set if an entry for accessor is found.
Optional
createMissing: booleanIf true missing accessor entries will be created as objects automatically.
Returns void
- data: object
Provides a way to safely batch set an objects data / entries given an array of accessor strings which describe the entries to walk. To access deeper entries into the object format the accessor string with
.
between entries to walk. If value is an object the accessor will be used to access a target value fromvalue
which is subsequently set todata
by the given operation. Ifvalue
is not an object it will be used as the target value to set across all accessors.