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 (email, raw) => {
if (!raw && process.stdout.isTTY) {
spinner.start();
}
return Promise.resolve(pasteAccount(email))
.then((pasteData) => {
if (!raw && process.stdout.isTTY) {
spinner.stop(true);
}
if (pasteData && raw) {
logger.log(JSON.stringify(pasteData));
} else if (pasteData) {
logger.log(prettyjson.render(pasteData));
} else if (!pasteData && !raw) {
logger.log('Good news — no pwnage found!');
}
})
.catch((err) => {
if (!raw && process.stdout.isTTY) {
spinner.stop(true);
}
export const handler = async ({
email,
raw,
}: PaHandlerOptions): Promise => {
if (!raw) {
spinner.start();
}
try {
const pasteData = await pasteAccount(email, {
apiKey: config.get('apiKey'),
userAgent,
});
if (pasteData && raw) {
logger.log(JSON.stringify(pasteData));
} else if (pasteData) {
spinner.stop();
logger.log(prettyjson.render(pasteData));
} else if (!pasteData && !raw) {
spinner.succeed('Good news — no pwnage found!');
}
} catch (err) {
const errMsg = translateApiError(err.message);
if (!raw) {
spinner.fail(errMsg);
} else {