Skip to content

Commit 2899014

Browse files
committed
fix(node): prevent crash if color is undefined
1 parent 177b0ce commit 2899014

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/node.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,11 @@ export class Log extends LogBase {
300300
* @private
301301
*/
302302
_color(str, color, isBold) {
303-
return !this.opts.colors ? str : isBold ? color.bold(str) : color(str)
303+
return !color || !this.opts?.colors
304+
? str
305+
: isBold
306+
? color.bold(str)
307+
: color(str)
304308
}
305309
}
306310

0 commit comments

Comments
 (0)