From fbd17e7a699e7a7a1d3ebbb0ce4961b5ea172449 Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Sun, 30 Jul 2017 22:41:47 -0700 Subject: [PATCH] Escape backslashes in template arguments (fixes #177) --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 87300fc..204889c 100644 --- a/index.js +++ b/index.js @@ -205,7 +205,7 @@ function chalkTag(chalk, strings) { const parts = [strings.raw[0]]; for (let i = 1; i < strings.length; i++) { - parts.push(args[i - 1].toString().replace(/[{}]/g, '\\$&')); + parts.push(args[i - 1].toString().replace(/[{}\\]/g, '\\$&')); parts.push(strings.raw[i]); }