Fix undefined and null interpolated expressions (fixes #194)
This commit is contained in:
parent
106f086aaf
commit
69ac663f29
2 changed files with 8 additions and 2 deletions
4
index.js
4
index.js
|
|
@ -207,8 +207,8 @@ 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(strings.raw[i]);
|
||||
parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&'));
|
||||
parts.push(String(strings.raw[i]));
|
||||
}
|
||||
|
||||
return template(chalk, parts.join(''));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue