lib/speak.js   A
last analyzed

Complexity

Total Complexity 2
Complexity/F 2

Size

Lines of Code 23
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
c 1
b 0
f 0
nc 1
dl 0
loc 23
rs 10
wmc 2
mnd 1
bc 3
fnc 1
bpm 3
cpm 2
noi 3

1 Function

Rating   Name   Duplication   Size   Complexity  
A speak.js ➔ speak 0 11 2
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
The parameter type='console' does not exist. Did you maybe forget to remove this comment?
Loading history...
8
 * @param {String} [color='cyan'] - color of message
0 ignored issues
show
Documentation introduced by
The parameter color='cyan' does not exist. Did you maybe forget to remove this comment?
Loading history...
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
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
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