fossasia/loklak_webclient

View on GitHub
iframely/lib/plugins/system/cheerio.js

Summary

Maintainability
A
0 mins
Test Coverage
var cheerio = require('cheerio');
var htmlparser2 = require("htmlparser2");
var DomHandler = htmlparser2.DomHandler;

module.exports = {

    provides: 'self',

    getData: function(htmlparser, cb) {

        var domHandler = new DomHandler(function(error, dom) {

            if (error) {
                return cb(error);
            }

            cb(null, {
                cheerio: cheerio.load(dom)
            });
        });

        htmlparser.addHandler(domHandler);
    }

};