1 | /**
|
2 | * Utility functions for managing HTML content
|
3 | *
|
4 | */
|
5 | var cheerio = require('cheerio');
|
6 |
|
7 | module.exports.isHTML = function (body) {
|
8 |
|
9 | return body.match(/^\s*</) !== null;
|
10 | };
|
11 |
|
12 |
|
13 | module.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 | };
|