From 234f67eba78309e5734ebfc005d4f4f56c5a8b79 Mon Sep 17 00:00:00 2001 From: Akash Raghav Date: Sun, 6 Feb 2022 06:28:58 +0530 Subject: [PATCH] bug fix - combined mapped arg with blank string combined x.toString() result with blank string to avoid exception in case x is invalid/undefined, failing to call toString() let s = args.map(x => x.toString()).join(' '); ^ TypeError: Cannot read properties of undefined (reading 'toString') --- lib/log.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/log.js b/lib/log.js index 394b356c..b74feb03 100644 --- a/lib/log.js +++ b/lib/log.js @@ -52,7 +52,7 @@ log.init = function() { const args = Array.from(arguments); if (name !== 'INFO') args.unshift('[' + name + ']'); - let s = args.map(x => x.toString()).join(' '); + let s = args.map(x => ('' + x.toString())).join(' '); if (level.color) s = chalk[level.color](s); this.output(s);