Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | import chalk from 'chalk' export function log(type: 'success' | 'fail', label?: string) { return <T extends any[]>(...args: T) => { if (type === 'success') { console.log('\n', label ? chalk.bgGreen(` ${label} `) : '', chalk.green(...args)) } else if (type === 'fail') { console.log('\n', label ? chalk.black.bgRgb(220, 50, 50)(` ${label} `) : '', chalk.red(...args)) } else { throw new Error(`type "${type as string}" isn't allowed`) } } } |