lib/jyt.parser.js
function parse(html, cb) {

    if (!cb) {
        throw new Error('Must pass in callback to parse() as 2nd param');
    }

    var handler = new htmlparser.DefaultHandler(function (error, dom) {
        if (error) {
            cb('Error while parsing: ' + error);
        }
        else {
            var jytObj = convertDomToJyt(dom);
            cb(null, jytObj);
        }
    }, { ignoreWhitespace: true });

    var parser = new htmlparser.Parser(handler);
    parser.parseComplete(html);
}
function parse(html, cb) {

    if (!cb) {
        throw new Error('Must pass in callback to parse() as 2nd param');
    }

    var handler = new htmlparser.DefaultHandler(function (error, dom) {
        if (error) {
            cb('Error while parsing: ' + error);
        }
        else {
            var jytObj = convertDomToJyt(dom);
            cb(null, jytObj);
        }
    }, { ignoreWhitespace: true });

    var parser = new htmlparser.Parser(handler);
    parser.parseComplete(html);
}
function parse ( html , cb ) { if ( ! cb ) { throw new Error ( 'Must pass in callback to parse() as 2nd param' ) ; } var handler = new htmlparser . DefaultHandler ( function ( error , dom ) { if ( error ) { cb ( 'Error while parsing: ' + error ) ; } else { var jytObj = convertDomToJyt ( dom ) ; cb ( null , jytObj ) ; } } , { ignoreWhitespace : true } ) ; var parser = new htmlparser . Parser ( handler ) ; parser . parseComplete ( html ) ; }
Parse the HTML into Jyt format
@param html
@param cb
@returns {*}
Parse the HTML into Jyt format