All files / src index.js

100% Statements 13/13
100% Branches 0/0
100% Functions 3/3
100% Lines 11/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 161x 1x 1x   1x     39x 39x 39x 39x 81x 39x 81x    
const HtmlParser = require('./htmlParser/HtmlParser.class')
const StringStream = require('./htmlParser/StringStream.class')
const Collector = require('./htmlParser/Collector.class')
 
module.exports = {
  HtmlParser,
  parse(html) {
     const htmlParser = new HtmlParser()
     const stringStream = new StringStream(html)
     stringStream.pipe(htmlParser)
     const collector = new Collector()
     htmlParser.on('data', str => collector.write(str))
     stringStream.read()
     return collector.data.map(data => JSON.parse(data))
  }
}