UNPKG

407 BJavaScriptView Raw
1const cheerio = require('cheerio');
2
3const htmlParser = {};
4
5/**
6 * Get items from html content.
7 * @param content
8 * @param selectors
9 */
10htmlParser.getItems = function (content, selectors,callback) {
11 var $ = cheerio.load(content);
12 if(typeof callback==='function'){
13 $(selectors).each(function(i,e){
14 callback($,i,e);
15 });
16 }
17}
18module.exports=htmlParser;
\No newline at end of file