objRef
Returns a reference to an object value
Parameters
Parameter | Type | Description |
---|---|---|
obj | string or object |
object to reference |
path | string |
path of properties Note: It'll throw an error on trailing separator. |
separator | string or undefined |
separator of property names |
buildRef | boolean or undefined |
option to build reference |
Examples
//Example objectvar a = b : c : d : 1 e : 2 //Basic examplevar d = ; //d === 1 //We can use a custom separatorvar e = ; // e === 2 //Build an object reference var f = ;var abc = ; abcf = 100; //a.b.c.f === 100; //Trailing separatorvar d = ; //this will throw an error - Invalid path