Created
January 3, 2019 16:12
-
-
Save GUIEEN/8db1757f6ef11fd706c42a4496a47a81 to your computer and use it in GitHub Desktop.
Stdout message with color.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import colors from 'colors' | |
const log = (...args: Object[]) => { | |
args.forEach(e => { | |
if (typeof e === 'object') { | |
console.dir(e, { depth: null }) | |
} else if (typeof e === 'boolean') { | |
console.log(colors.bgMagenta.white(` ${e} `)) | |
} else { | |
console.log(colors.bgCyan.black(` ${e} `)) | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment