From 9b92741c9e246d364101e302d9039820c4e9ec7e 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]); }