static legislation(leg) {
    const legislation = leg;
    return new Promise((resolve, reject) => {
      // ScrapStatus.legislationStart(legislation.url);
      pvt.requestOptions.url = legislation.url;
      request(pvt.requestOptions)
        .then((data) => {
          const $ = cheerio.load(data, { decodeEntities: false });
          $('head').remove();
          $('*').each(function removeAttributes() {
            // if (!(this.type === 'tag' && this.name === 'a')) {
            this.attribs = {};
            // }
          });
          $.root()
            .contents()
            .filter(function filter() {
              return this.type === 'head';
            })
            .remove();
          return $.html()
            .replace(/(<html>[\s\S]*<body>)([\s\S]*)/, '$2')
            .replace(/([\s\S]*)(<\/body>[\s\S]*<\/html>)/, '$1');
        })
        .then((content) => {
          legislation.content = content;
          resolve(legislation);
        })
        .catch((err) => {
          error(legislation.name, legislation.url, 'Could not reach legislation', err);
          reject(err);
        });
    });
  }
/**
   * @method legislation
   * @private
   * @param {Object} leg Legislation object
   * @return {Promise} Promise with the same legislation object with the clean html on content attribute
   */
@method legislation
@private
@param {Object} leg Legislation object
@return {Promise} Promise with the same legislation object with the clean html on content attribute
@method legislation @private @param { Object } leg Legislation object @return { Promise } Promise with the same legislation object with the clean html on content attribute
static legislation(leg) {
    const legislation = leg;
    return new Promise((resolve, reject) => {
      pvt.requestOptions.url = legislation.url;
      request(pvt.requestOptions)
        .then((data) => {
          const $ = cheerio.load(data, { decodeEntities: false });
          $('head').remove();
          $('*').each(function removeAttributes() {
            this.attribs = {};
          });
          $.root()
            .contents()
            .filter(function filter() {
              return this.type === 'head';
            })
            .remove();
          return $.html()
            .replace(/(<html>[\s\S]*<body>)([\s\S]*)/, '$2')
            .replace(/([\s\S]*)(<\/body>[\s\S]*<\/html>)/, '$1');
        })
        .then((content) => {
          legislation.content = content;
          resolve(legislation);
        })
        .catch((err) => {
          error(legislation.name, legislation.url, 'Could not reach legislation', err);
          reject(err);
        });
    });
  }
static legislation ( leg ) { const legislation = leg ; return new Promise ( ( resolve , reject ) => { pvt . requestOptions . url = legislation . url ; request ( pvt . requestOptions ) . then ( ( data ) => { const $ = cheerio . load ( data , { decodeEntities : false } ) ; $ ( 'head' ) . remove ( ) ; $ ( '*' ) . each ( function removeAttributes ( ) { this . attribs = { } ; } ) ; $ . root ( ) . contents ( ) . filter ( function filter ( ) { return this . type === 'head' ; } ) . remove ( ) ; return $ . html ( ) . replace ( / (<html>[\s\S]*<body>)([\s\S]*) / , '$2' ) . replace ( / ([\s\S]*)(<\/body>[\s\S]*<\/html>) / , '$1' ) ; } ) . then ( ( content ) => { legislation . content = content ; resolve ( legislation ) ; } ) . catch ( ( err ) => { error ( legislation . name , legislation . url , 'Could not reach legislation' , err ) ; reject ( err ) ; } ) ; } ) ; }
@method legislation
 @private
 @param {Object} leg Legislation object
 @return {Promise} Promise with the same legislation object with the clean html on content attribute
@method legislation @private @param { Object } leg Legislation object @return { Promise } Promise with the same legislation object with the clean html on content attribute
// ScrapStatus.legislationStart(legislation.url); // if (!(this.type === 'tag' && this.name === 'a')) { // }