Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default (domain, raw) => {
if (!raw && process.stdout.isTTY) {
spinner.start();
}
return Promise.resolve(breaches({ domain }))
.then((breachData) => {
if (!raw && process.stdout.isTTY) {
spinner.stop(true);
}
if (breachData.length && raw) {
logger.log(JSON.stringify(breachData));
} else if (breachData.length) {
logger.log(prettyjson.render(breachData));
} else if (!breachData.length && !raw) {
logger.log('No breaches found.');
}
})
.catch((err) => {
if (!raw && process.stdout.isTTY) {
spinner.stop(true);
}