Skip to content

Commit f682f74

Browse files
authored
Escape assert strings
This fixes .string("var", "string with \n in it")
1 parent 9df466c commit f682f74

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/binary_parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ export class Parser {
10031003
ctx.pushCode(`if (${this.options.assert} !== ${varName}) {`);
10041004
break;
10051005
case "string":
1006-
ctx.pushCode(`if ("${this.options.assert}" !== ${varName}) {`);
1006+
ctx.pushCode(`if (${JSON.stringify(this.options.assert)} !== ${varName}) {`);
10071007
break;
10081008
default:
10091009
throw new Error(

0 commit comments

Comments
 (0)