parse({
    source, mediaType, generateSourceMap = false, adapterOptions,
  }, done) {
    const adapter = this.findAdapter(source, mediaType, 'parse');

    if (!adapter) {
      const error = new Error('Document did not match any registered parsers!');

      if (done) {
        done(error);
        return null;
      }

      return Promise.reject(error);
    }

    let options = {
      generateSourceMap, namespace: this.minim, mediaType, source,
    };

    if (adapterOptions) {
      options = Object.assign(options, adapterOptions);
    }

    const promise = adapter.parse(options)
      .then((parseResult) => {
        if (parseResult instanceof this.minim.Element) {
          return parseResult;
        }

        return this.load(parseResult);
      });

    if (done) {
      promise.then(result => done(null, result), done);
      return null;
    }

    return promise;
  }
/**
   * Parse an API Description Document
   *
   * This method uses the registered adapters to automatically detect the
   * input format, then uses the adapter to convert into refract elements
   * and loads these into objects.
   *
   * @param {Object} options
   * @param {string} options.source
   * @param {string} [options.mediaType]
   * @param {AdapterOptions} [options.adapterOptions]
   * @param callback {ParseCallback}
   */
Parse an API Description Document
This method uses the registered adapters to automatically detect the
input format, then uses the adapter to convert into refract elements
and loads these into objects.


Parse an API Description Document This method uses the registered adapters to automatically detect the input format then uses the adapter to convert into refract elements and loads these into objects .
parse({
    source, mediaType, generateSourceMap = false, adapterOptions,
  }, done) {
    const adapter = this.findAdapter(source, mediaType, 'parse');
    if (!adapter) {
      const error = new Error('Document did not match any registered parsers!');
      if (done) {
        done(error);
        return null;
      }
      return Promise.reject(error);
    }
    let options = {
      generateSourceMap, namespace: this.minim, mediaType, source,
    };
    if (adapterOptions) {
      options = Object.assign(options, adapterOptions);
    }
    const promise = adapter.parse(options)
      .then((parseResult) => {
        if (parseResult instanceof this.minim.Element) {
          return parseResult;
        }
        return this.load(parseResult);
      });
    if (done) {
      promise.then(result => done(null, result), done);
      return null;
    }
    return promise;
  }
parse ( { source , mediaType , generateSourceMap = false , adapterOptions , } , done ) { const adapter = this . findAdapter ( source , mediaType , 'parse' ) ; if ( ! adapter ) { const error = new Error ( 'Document did not match any registered parsers!' ) ; if ( done ) { done ( error ) ; return null ; } return Promise . reject ( error ) ; } let options = { generateSourceMap , namespace : this . minim , mediaType , source , } ; if ( adapterOptions ) { options = Object . assign ( options , adapterOptions ) ; } const promise = adapter . parse ( options ) . then ( ( parseResult ) => { if ( parseResult instanceof this . minim . Element ) { return parseResult ; } return this . load ( parseResult ) ; } ) ; if ( done ) { promise . then ( result => done ( null , result ) , done ) ; return null ; } return promise ; }
Parse an API Description Document
 This method uses the registered adapters to automatically detect the
 input format, then uses the adapter to convert into refract elements
 and loads these into objects.
Parse an API Description Document This method uses the registered adapters to automatically detect the input format then uses the adapter to convert into refract elements and loads these into objects .