code: function parseCircular(object) {
    // if circular references are disabled, just return the refs object
    if (!config().circularRefs) {
      return object;
    }
  
    let pointerPath = parsePointer(object.$ref);
  
    // validate whether the path corresponds with current stack
    for (let i = 0; i < pointerPath.length; i++) {
      if (pointerPath[i] !== path[i]) {
        throw new Error('Invalid circular reference "' +  object.$ref + '"');
      }
    }
  
    return stack[pointerPath.length];
  }
docs: Resolve a circular reference.
  Throws an error if the path cannot be resolved
  @param {Object} object    An object with a JSON Pointer URI fragment
  like {$ref: '#/foo/bar'}
  @return {Object | Array}