/* eslint-disable no-console */ import chalk from 'chalk'; import lodash from 'lodash'; export const print = (...arg: unknown[]): void => { console.log(...arg); }; export const printSuccess = (message: string): void => { console.log(chalk.green(`SUCCESS: ${message}`)); }; export const printError = (error: string): void => { console.log(chalk.red(`ERROR: ${error}`)); }; export class PrintTime { static getMessage(message: string): string { return message; } static start(message: string): void { console.time(this.getMessage(message)); } static end(message: string): void { console.timeEnd(this.getMessage(message)); } } export const printInfo = (printInfo: string, color = 'cyan') => { let colors = [ 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'gray', 'cyanBright', 'greenBright', 'magentaBright', ]; if (!lodash.isString(color)) { color = 'cyan'; } else { let difference = lodash.difference([color], colors); color = difference.length === 0 ? color : 'cyan'; } //@ts-ignore console.log(chalk[color](printInfo)); }; export const logInfo = (msg: string) => { printInfo(msg, 'green'); };