/* !
## parsePath(path)

Helper function used to parse string object
paths. Use in conjunction with `internalGetPathValue`.

var parsed = parsePath('myobject.property.subprop');

### Paths:

* Can be infinitely deep and nested.
* Arrays are also valid using the formal `myobject.document[3].property`.
* Literal dots and brackets (not delimiter) must be backslash-escaped.

@param {String} path
@returns {Object} parsed
@api private
function parsePath(path) {
  var str = path.replace(/([^\\])\[/g, '$1.[');
  var parts = str.match(/(\\\.|[^.]+?)+/g);
  return parts.map(function mapMatches(value) {
    var regexp = /^\[(\d+)\]$/;
    var mArr = regexp.exec(value);
    var parsed = null;
    if (mArr) {
      parsed = { i: parseFloat(mArr[1]) };
    } else {
      parsed = { p: value.replace(/\\([.\[\]])/g, '$1') };
    }

    return parsed;
  });
}