src/execute-js-func.js
function objectAndParentGivenPath(path) {
  let obj = global || window;
  let parent = obj;

  for (let part of path.split('.')) {
    parent = obj;
    obj = obj[part];
  }

  d(`parent: ${parent}, obj: ${obj}`);
  if (typeof(parent) !== 'object') {
    throw new Error(`Couldn't access part of the object window.${path}`);
  }

  return [parent, obj];
}
function objectAndParentGivenPath(path) {
  let obj = global || window;
  let parent = obj;

  for (let part of path.split('.')) {
    parent = obj;
    obj = obj[part];
  }

  d(`parent: ${parent}, obj: ${obj}`);
  if (typeof(parent) !== 'object') {
    throw new Error(`Couldn't access part of the object window.${path}`);
  }

  return [parent, obj];
}
Walks the global object hierarchy to resolve the actual object that a dotted
object path refers to.

@param  {string} path  A path to the object to execute, in dotted
form i.e. 'document.querySelector'.

@return {Array<string>}      Returns the actual method object and its parent,
usually a Function and its `this` parameter, as
`[parent, obj]`

@private