* Adds ANSI color escape codes if enabled. * * @api public
(args)
| 165 | */ |
| 166 | |
| 167 | function formatArgs(args) { |
| 168 | const {namespace: name, useColors} = this; |
| 169 | |
| 170 | if (useColors) { |
| 171 | const c = this.color; |
| 172 | const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); |
| 173 | const prefix = ` ${colorCode};1m${name} \u001B[0m`; |
| 174 | |
| 175 | args[0] = prefix + args[0].split('\n').join('\n' + prefix); |
| 176 | args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); |
| 177 | } else { |
| 178 | args[0] = getDate() + name + ' ' + args[0]; |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | function getDate() { |
| 183 | if (exports.inspectOpts.hideDate) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…