Jxck/html2json

HTMLParser is not defined

obonyojimmy opened this issue · 0 comments

Kindly include HTMLParser as a dependency to avoid node HTMLParser is not defined compilation errors in node ,

this line (line 5-7 ) :

if (typeof window === 'undefined') {
    require('../lib/Pure-JavaScript-HTML5-Parser/htmlparser.js');
  }

why not directly include the dependency either by checking if type is node module export as in below :

if (typeof module === "object" && typeof module.exports === "object") {
  require('../lib/Pure-JavaScript-HTML5-Parser/htmlparser.js');
}