map.apps Bundle APIs 4.20.0
    Preparing search index...
    • Parses a complex property path expression like "coordinate.x" in order to access the properties in target objects.

      Parameters

      • Optionalpath: string | symbol

        the target path, e.g. "a.b.name"

      Returns PathAccessorFactory

      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