| Total Complexity | 2 |
| Complexity/F | 2 |
| Lines of Code | 23 |
| Function Count | 1 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 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 |
||
|
|
|||
| 8 | * @param {String} [color='cyan'] - color of message |
||
| 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 |