function crawl (parent, key, path, pathFromRoot, indirections, inventory, $refs, options) {
var obj = key === null ? parent : parent[key];

if (obj && typeof obj === 'object') {
  if ($Ref.isAllowed$Ref(obj)) {
    inventory$Ref(parent, key, path, pathFromRoot, indirections, inventory, $refs, options);
  }
  else {
    var keys = Object.keys(obj);

    // Most people will expect references to be bundled into the the "definitions" property,
    // so we always crawl that property first, if it exists.
    var defs = keys.indexOf('definitions');
    if (defs > 0) {
      keys.splice(0, 0, keys.splice(defs, 1)[0]);
    }

    keys.forEach(function (key) {
      var keyPath = Pointer.join(path, key);
      var keyPathFromRoot = Pointer.join(pathFromRoot, key);
      var value = obj[key];

      if ($Ref.isAllowed$Ref(value)) {
        inventory$Ref(obj, key, path, keyPathFromRoot, indirections, inventory, $refs, options);
      }
      else {
        crawl(obj, key, keyPath, keyPathFromRoot, indirections, inventory, $refs, options);
      }
    });
  }
}
}
Recursively crawls the given value, and inventories all JSON references.

@param {object} parent - The object containing the value to crawl. If the value is not an object or array, it will be ignored.
@param {string} key - The property key of `parent` to be crawled
@param {string} path - The full path of the property being crawled, possibly with a JSON Pointer in the hash
@param {string} pathFromRoot - The path of the property being crawled, from the schema root
@param {object[]} inventory - An array of already-inventoried $ref pointers
@param {$Refs} $refs
@param {$RefParserOptions} options