UNPKG

388 BJavaScriptView Raw
1/**
2 * Utility functions for managing HTML content
3 *
4 */
5var cheerio = require('cheerio');
6
7module.exports.isHTML = function (body) {
8
9 return body.match(/^\s*</) !== null;
10};
11
12
13module.exports.$ = function (body) {
14
15 var options = {
16 normalizeWhitespace: false,
17 xmlMode: false,
18 decodeEntities: true
19 };
20 return cheerio.load(body, options);
21
22};