1'use strict'; 2 3const Parser = require('./parser'); 4const Serializer = require('./serializer'); 5 6// Shorthands 7exports.parse = function parse(html, options) { 8 const parser = new Parser(options); 9 10 return parser.parse(html); 11}; 12 13exports.parseFragment = function parseFragment(fragmentContext, html, options) { 14 if (typeof fragmentContext === 'string') { 15 options = html; 16 html = fragmentContext; 17 fragmentContext = null; 18 } 19 20 const parser = new Parser(options); 21 22 return parser.parseFragment(html, fragmentContext); 23}; 24 25exports.serialize = function(node, options) { 26 const serializer = new Serializer(node, options); 27 28 return serializer.serialize(); 29}; 30