Skip to content

Commit e776857

Browse files
authored
Merge pull request #198 from vexcat/patch-1
Escape assert strings
2 parents 9b24a00 + abfe170 commit e776857

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/binary_parser.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,9 @@ 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(
1007+
`if (${JSON.stringify(this.options.assert)} !== ${varName}) {`
1008+
);
10071009
break;
10081010
default:
10091011
throw new Error(

0 commit comments

Comments
 (0)