(input, options)
| 39 | }; |
| 40 | |
| 41 | var addColorToData = function(input, options) { |
| 42 | if (options.noColor) { |
| 43 | return input; |
| 44 | } |
| 45 | |
| 46 | if (typeof input === 'string') { |
| 47 | // Print strings in regular terminal color |
| 48 | return options.stringColor ? colors[options.stringColor](input) : input; |
| 49 | } |
| 50 | |
| 51 | var sInput = input + ''; |
| 52 | |
| 53 | if (input === true) { |
| 54 | return colors.green(sInput); |
| 55 | } |
| 56 | if (input === false) { |
| 57 | return colors.red(sInput); |
| 58 | } |
| 59 | if (input === null || input === undefined) { |
| 60 | return colors.grey(sInput); |
| 61 | } |
| 62 | if (typeof input === 'number') { |
| 63 | if (input >= 0) { |
| 64 | return colors[options.positiveNumberColor](sInput); |
| 65 | } else { |
| 66 | return colors[options.negativeNumberColor](sInput); |
| 67 | } |
| 68 | } |
| 69 | if (typeof input === 'function') { |
| 70 | return 'function() {}'; |
| 71 | } |
| 72 | |
| 73 | if (Array.isArray(input)) { |
| 74 | return input.join(', '); |
| 75 | } |
| 76 | |
| 77 | return sInput; |
| 78 | }; |
| 79 | |
| 80 | var colorMultilineString = function(options, line) { |
| 81 | if (options.multilineStringColor === null || options.noColor) { |
no outgoing calls
no test coverage detected
searching dependent graphs…