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 (account, domain, truncate, raw) => {
if (!raw && process.stdout.isTTY) {
spinner.start();
}
return Promise.resolve(search(account, { domain, truncate }))
.then((searchData) => {
const foundData = !!(searchData.breaches || searchData.pastes);
if (!raw && process.stdout.isTTY) {
spinner.stop(true);
}
if (foundData && raw) {
logger.log(JSON.stringify(searchData));
} else if (foundData) {
logger.log(prettyjson.render(searchData));
} else if (!foundData && !raw) {
logger.log('Good news — no pwnage found!');
}
})
.catch((err) => {
if (!raw && process.stdout.isTTY) {
spinner.stop(true);
export const handler = async ({
account,
domainFilter: domain,
truncate,
raw,
}: SearchHandlerOptions): Promise => {
if (!raw) {
spinner.start();
}
try {
const searchData = await search(account, { domain, truncate, userAgent });
const foundData = !!(searchData.breaches || searchData.pastes);
if (foundData && raw) {
logger.log(JSON.stringify(searchData));
} else if (foundData) {
spinner.stop();
logger.log(prettyjson.render(searchData));
} else if (!foundData && !raw) {
spinner.succeed('Good news — no pwnage found!');
}
} catch (err) {
if (!raw) {
spinner.fail(err.message);
} else {
logger.error(err.message);
}
}