code: function stringifyCircular (value, replacer, space, indent) {
    if (!config().circularRefs) {
      throw new Error('Circular reference at "' + stringifyPointer(path) + '"');
    }
  
    let pathIndex = stack.indexOf(value);
  
    let circular = {
      $ref: stringifyPointer(path.slice(0, pathIndex))
    };
  
    return stringifyObject(circular, replacer, space, indent);
  }
docs: Stringify a circular reference
  @param {Object | Array} value
  @param {function | Array.<string | number>} [replacer]
  @param {string} [space]
  @param {string} [indent]
  @return {string}