You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/**
* Module Dependencies
*/
// Any module dependencies go here
/**
* Export the default `driver`
*/
module.exports = driver;
/**
* Initialize the html
* `driver` to support
* html strings instead of
* just a url
* @param {Object} opts
* @return {Function} plugin
*/
function driver(opts) {
return function plugin(xray) {
xray.request = function request(htmlString, fn) {
return fn(null, htmlString);
};
return xray;
}
}
Usage
var xrayHtml = require('x-ray-html');
xray('<p class="title"><strong>It Works!</strong></p>')
.use(xrayHtml())
.select('.title')
.run(function(err, extraction) {
// Return on error
if (err) return console.log(err);
// Log extraction results to console
console.log(extraction);
});