content.js
function parse(data, options, next) {
    data = this.get(data);

    if ('function' === typeof options) {
      next = options;
      options = {};
    }

    //
    // We cannot detect a license so we call the callback without any arguments
    // which symbolises a failed attempt.
    //
    if (!data) return next();

    //
    // Optimize the matches by trying to locate where the licensing information
    // starts in the given content. Usually, we, as developers add it at the
    // bottom of our README.md files and prefix it with "LICENSE" as header.
    //
    if (data.file && /readme/i.test(data.file)) {
      data.content.split('\n')
        .some(function some(line, index, lines) {
          if (
            /^.{0,7}\s{0,}(?:licen[cs]e[s]?|copyright).{0,2}\s{0,}$/gim.test(
              line.trim())
          ) {
            data.content = lines.slice(index).join('\n');
            debug('matched %s as license header, slicing data', JSON.stringify(line));
          return true;
        }

        return false;
      });
    }

    var license = this.scan(data.content);
    if (!license) {
      license = this.test(data.content);

      if (license) debug('used regexp to detect %s in content', license);
    } else {
      debug('license file scan resulted in %s as matching license', license);
    }


    next(undefined, this.normalize(license));
  }
function parse(data, options, next) {
    data = this.get(data);

    if ('function' === typeof options) {
      next = options;
      options = {};
    }

    //
    // We cannot detect a license so we call the callback without any arguments
    // which symbolises a failed attempt.
    //
    if (!data) return next();

    //
    // Optimize the matches by trying to locate where the licensing information
    // starts in the given content. Usually, we, as developers add it at the
    // bottom of our README.md files and prefix it with "LICENSE" as header.
    //
    if (data.file && /readme/i.test(data.file)) {
      data.content.split('\n')
        .some(function some(line, index, lines) {
          if (
            /^.{0,7}\s{0,}(?:licen[cs]e[s]?|copyright).{0,2}\s{0,}$/gim.test(
              line.trim())
          ) {
            data.content = lines.slice(index).join('\n');
            debug('matched %s as license header, slicing data', JSON.stringify(line));
          return true;
        }

        return false;
      });
    }

    var license = this.scan(data.content);
    if (!license) {
      license = this.test(data.content);

      if (license) debug('used regexp to detect %s in content', license);
    } else {
      debug('license file scan resulted in %s as matching license', license);
    }


    next(undefined, this.normalize(license));
  }
function parse ( data , options , next ) { data = this . get ( data ) ; if ( 'function' === typeof options ) { next = options ; options = { } ; } // // We cannot detect a license so we call the callback without any arguments // which symbolises a failed attempt. // if ( ! data ) return next ( ) ; // // Optimize the matches by trying to locate where the licensing information // starts in the given content. Usually, we, as developers add it at the // bottom of our README.md files and prefix it with "LICENSE" as header. // if ( data . file && / readme / i . test ( data . file ) ) { data . content . split ( '\n' ) . some ( function some ( line , index , lines ) { if ( / ^.{0,7}\s{0,}(?:licen[cs]e[s]?|copyright).{0,2}\s{0,}$ / gim . test ( line . trim ( ) ) ) { data . content = lines . slice ( index ) . join ( '\n' ) ; debug ( 'matched %s as license header, slicing data' , JSON . stringify ( line ) ) ; return true ; } return false ; } ) ; } var license = this . scan ( data . content ) ; if ( ! license ) { license = this . test ( data . content ) ; if ( license ) debug ( 'used regexp to detect %s in content' , license ) ; } else { debug ( 'license file scan resulted in %s as matching license' , license ) ; } next ( undefined , this . normalize ( license ) ) ; }
Parse the markdown information from the package.

@param {Object} data The package.json or npm package contents.
@param {Object} options Optional options.
@param {Function} next Continuation.
@api public
Parse the markdown information from the package .