osmosis
Version:
Web scraper for NodeJS
26 lines (20 loc) • 457 B
JavaScript
/*jslint node: true */
;
/**
* Check that the context node matches the given selector.
*
* @function filter
* @memberof Command
* @param {Selector} match - A Selector to match
* @instance
*/
function Filter(context, data, next, done) {
if (context.find(this.selector).length > 0) {
next(context, data);
}
done();
}
module.exports.filter = function (selector) {
this.selector = selector;
return Filter;
};