Fix escape char not interpreted in expressions
This commit is contained in:
1 parent
53bb4d3552
commit
7ae3bcdc0f
1 file changed
+1
-1
@@ -29,7 +29,7 @@ function interpretEscapes(str): string {
|
|||||||
r: "\r",
|
r: "\r",
|
||||||
t: "\t",
|
t: "\t",
|
||||||
};
|
};
|
||||||
return str.replace(/\\(u[0-9a-fA-F]{4}|[^u])/, (_, escape) => {
|
return str.replace(/\\(u[0-9a-fA-F]{4}|[^u])/g, (_, escape) => {
|
||||||
const type = escape.charAt(0);
|
const type = escape.charAt(0);
|
||||||
const hex = escape.slice(1);
|
const hex = escape.slice(1);
|
||||||
if (type === "u") return String.fromCharCode(parseInt(hex, 16));
|
if (type === "u") return String.fromCharCode(parseInt(hex, 16));
|
||||||
|
|||||||
Reference in new issue
Block a user