1 | const chalk = require('chalk'); |
||
2 | const figlet = require('figlet'); |
||
3 | |||
4 | /** |
||
5 | * Print a message on the console |
||
6 | * @param {String} message - message to print to screen |
||
7 | * @param {String} [type='console'] - type of message to print |
||
0 ignored issues
–
show
Documentation
introduced
by
![]() |
|||
8 | * @param {String} [color='cyan'] - color of message |
||
0 ignored issues
–
show
|
|||
9 | * @returns {Void} returns nothing |
||
10 | */ |
||
11 | function speak(message, type = 'console', color = 'cyan') { |
||
12 | if (type === 'console') { |
||
13 | console.log(chalk[color](message)); //eslint-disable-line |
||
14 | } else { |
||
15 | console.log( //eslint-disable-line |
||
16 | chalk[color]( |
||
17 | figlet.textSync(message, { horizontalLayout: 'full' }) |
||
18 | )); |
||
19 | } |
||
20 | return { type, message, color }; |
||
21 | } |
||
22 | |||
23 | module.exports = speak; |
||
24 |