dist/util.js
function _getPath(o, pathSegments) {
  if (o == null) {
    return undefined;
  }

  var head = pathSegments[0],
      tail = pathSegments.slice(1);

  if (Array.isArray(o) && !(head in o)) {
    o = o.reduce(function (acc, x) {
      if (!x) {
        return acc;
      }

      var y = x[head];

      if (Array.isArray(y)) {
        acc.push.apply(acc, y);
      } else {
        acc.push(y);
      }

      return acc;
    }, []);
  } else {
    o = o[head];
  }

  if (!tail.length) {
    return o;
  } else {
    return o ? _getPath(o, tail) : undefined;
  }
}
function _getPath(o, pathSegments) {
  if (o == null) {
    return undefined;
  }

  var head = pathSegments[0],
      tail = pathSegments.slice(1);

  if (Array.isArray(o) && !(head in o)) {
    o = o.reduce(function (acc, x) {
      if (!x) {
        return acc;
      }

      var y = x[head];

      if (Array.isArray(y)) {
        acc.push.apply(acc, y);
      } else {
        acc.push(y);
      }

      return acc;
    }, []);
  } else {
    o = o[head];
  }

  if (!tail.length) {
    return o;
  } else {
    return o ? _getPath(o, tail) : undefined;
  }
}
Internal: Used by `getPath` to resolve a path into a value.  o            - The object to resolve the path from. pathSegments - An array of strings representing segments of the path to resolve.  Returns the resolved value or `undefined` if some segment of the path does not exist.