Optional
path: string | symbolthe target path, e.g. "a.b.name"
a path function which produces accessors.
import PropertyPath from "apprt-core/PropertyPath";
let path = PropertyPath("a.b.name");
// parser errors are reported by "invalid" property
if(path.invalid){
...
}
let target = {
a: {
b: {
name: "test"
}
}
};
let accessor = path(target);
accessor.invalid // -> false, but true if path is not accessible in target
accessor.exists() // -> true, b hasOwnProperty name
accessor.get() //-> "test"
accessor.set("new val") // -> changes target.a.b.name to "new val", will throw an error if property is not accessible
Parses a complex property path expression like "coordinate.x" in order to access the properties in target objects.