-
Notifications
You must be signed in to change notification settings - Fork 1
Function_evisit_core_js_utils_set
Wyatt Greenway edited this page Jan 31, 2017
·
4 revisions
- obj
- (Object) >>> Object to set property on
- path
- (String) Dot notation path to evaluate
- value
- (*) Value to set
- (String) Return the actual final path (relative to the base object) where the property was set. This is useful if property was pushed into an array; the actual array index will be returned as part of the final path
- With empty array notation in a specified path (i.e my.array.key[]) the value will be appended to the array specified
var obj = {}; utils.set(obj, 'hello.world', '!!!'); //hello.world utils.set(set, "arr[]", [1]); //arr[0] utils.set(obj, "arr[0][1]", 2); //arr[0][1] utils.set(obj, "arr[]", 3); //arr[1]