'use strict';

/**
 * Module dependencies.
 */
var Parser = require('htmlparser2/lib/Parser');
var DomHandler = require('domhandler');

/**
 * Parses HTML string to DOM nodes (server).
 *
 * This is the same method as `require('htmlparser2').parseDOM`
 * https://github.com/fb55/htmlparser2/blob/v3.9.1/lib/index.js#L39-L43
 *
 * @param  {String} html      - The HTML string.
 * @param  {Object} [options] - The parser options.
 * @return {Array}            - The DOM nodes.
 */
module.exports = function parseDOM(html, options) {
    if (typeof html !== 'string') {
        throw new TypeError('First argument must be a string.');
    }
    var handler = new DomHandler(options);
    new Parser(handler, options).end(html);
    return handler.dom;
};

'use strict';

/**
 * Module dependencies.
 */
var Parser = require('htmlparser2/lib/Parser');
var DomHandler = require('domhandler');

/**
 * Parse HTML string to DOM nodes.
 *
 * This is the same method as `require('htmlparser2').parseDOM`
 * https://github.com/fb55/htmlparser2/blob/master/lib/index.js#L39
 *
 * @param  {String} html    - The HTML.
 * @param  {Object} options - The parser options.
 * @return {Object}         - The DOM nodes.
 */
function parseDOM(html, options) {
    if (typeof html !== 'string') {
        throw new TypeError('First argument must be a string.');
    }

    var handler = new DomHandler(options);
    new Parser(handler, options).end(html);
    return handler.dom;
}

/**
 * Export HTML to DOM parser (server).
 */
module.exports = parseDOM;

--- 
+++ 
@@ -7,26 +7,20 @@
 var DomHandler = require('domhandler');
 
 /**
- * Parse HTML string to DOM nodes.
+ * Parses HTML string to DOM nodes (server).
  *
  * This is the same method as `require('htmlparser2').parseDOM`
- * https://github.com/fb55/htmlparser2/blob/master/lib/index.js#L39
+ * https://github.com/fb55/htmlparser2/blob/v3.9.1/lib/index.js#L39-L43
  *
- * @param  {String} html    - The HTML.
- * @param  {Object} options - The parser options.
- * @return {Object}         - The DOM nodes.
+ * @param  {String} html      - The HTML string.
+ * @param  {Object} [options] - The parser options.
+ * @return {Array}            - The DOM nodes.
  */
-function parseDOM(html, options) {
+module.exports = function parseDOM(html, options) {
     if (typeof html !== 'string') {
         throw new TypeError('First argument must be a string.');
     }
-
     var handler = new DomHandler(options);
     new Parser(handler, options).end(html);
     return handler.dom;
-}
-
-/**
- * Export HTML to DOM parser (server).
- */
-module.exports = parseDOM;
+};
Tidy JSDoc of server parser module
