putout
Version:
🐊 Pluggable and configurable code transformer with built-in ESLint, Babel and support of js, jsx, typescript, flow, markdown, yaml and json
21 lines (14 loc) • 367 B
JavaScript
import chalk from './chalk.mjs';
const {red} = chalk;
export const createExit = ({halt, raw, logError}) => (code, e) => {
if (!code)
return halt(0);
if (!e)
return halt(code);
const message = raw ? e : red(`🐊 ${e.message || e}`);
logError(message);
halt(code);
return {
exited: true,
};
};