From a306e608af08fd7a9d2453d2b1b0b85fbaa09c06 Mon Sep 17 00:00:00 2001 From: Tim Branyen Date: Wed, 16 Dec 2015 10:58:41 -0800 Subject: [PATCH] Symbols will not work with normal String concat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An example pulled from the Chrome Devtools Console: ``` const INCREMENT_COUNTER = Symbol('INCREMENT_COUNTER'); INCREMENT_COUNTER + "Hello" VM222:2 Uncaught TypeError: Cannot convert a Symbol value to a string(…) ``` The fix is simple, coerce to a String by invoking the constructor around it. --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index dab88c6..3b169e4 100644 --- a/src/index.js +++ b/src/index.js @@ -70,7 +70,7 @@ function createLogger(options = {}) { const formattedTime = formatTime(time); const titleCSS = colors.title ? `color: ${colors.title(formattedAction)};` : null; - const title = `action ${formattedAction.type}${timestamp ? formattedTime : ``}${duration ? ` in ${took.toFixed(2)} ms` : ``}`; + const title = `action ${String(formattedAction.type)}${timestamp ? formattedTime : ``}${duration ? ` in ${took.toFixed(2)} ms` : ``}`; // render try {