ObjectPath
Parse js object paths using both dot and bracket notation. Stringify an array of properties into a valid path.
- parse JS object reference fragments
- build JS object reference fragments
- supports presence of unicode characters
- supports presence of control characters in key names
Parse a Path
ObjectPath.parse(str)
var ObjectPath = ; ObjectPath;// => ['a','1','b','c','d','e','f-f','g']
Build a Path String
ObjectPath.stringify(arr, [quote="'"], [forceQuote=false]);
var ObjectPath = ; ObjectPath;// => "a[1].b.c['d-d'].e" ObjectPath;// => 'a[1].b.c["d-d"].e' ObjectPath;// => "['a']['1']['b']['c']['d-d']['e']"
Normalize a Path
ObjectPath.normalize(str, [quote="'"], [forceQuote=false])
var ObjectPath = ; ObjectPath;// => "a[1].b.c.d.e['f-f'].g" ObjectPath;// => 'a[1].b.c.d.e["f-f"].g' ObjectPath;// => "['a']['1']['b']['c']['d']['e']['f-f']['g']"