You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
613 B
JavaScript
22 lines
613 B
JavaScript
'use strict';
|
|
|
|
const Promise = require("bluebird");
|
|
const bhttp = require("bhttp");
|
|
const chalk = require("chalk");
|
|
const repeatString = require("repeat-string");
|
|
|
|
const extractGarbage = require("./lib/extract-garbage");
|
|
|
|
Promise.map(urls, (url) => {
|
|
return Promise.try(() => {
|
|
return bhttp.get(process.argv[2]);
|
|
}).then((response) => {
|
|
let snippets = extractGarbage(response.body.toString());
|
|
|
|
snippets.forEach((snippet) => {
|
|
console.log(`${snippet.before}${chalk.red.bold(snippet.garbage)}${repeatString(".", snippet.whitespace.length)}${snippet.after}`);
|
|
console.log("---------");
|
|
});
|
|
});
|
|
});
|