Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function phantomas(url, opts) {
var events = new EventEmitter(),
browser, options;
debug('OS: %s %s', process.platform, process.arch);
debug('Node.js: %s', process.version);
debug('phantomas: %s', VERSION);
debug('Puppeteer: preferred revision r%s', puppeteer._launcher._preferredRevision);
debug('URL: <%s>', url);
// options handling
options = util._extend({}, opts || {}); // use util._extend to avoid #563
options.url = options.url || url || false;
debug('Options: %s', JSON.stringify(options));
events.setMaxListeners(100); // MaxListenersExceededWarning: Possible EventEmitter memory leak detected.
var results = new Results();
results.setUrl(url);
results.setGenerator('phantomas v' + VERSION);
// set up and run Puppeteer
browser = new Browser();