Skip to content

Commit 719de30

Browse files
KnisterPetermichaelficarra
authored andcommitted
fix: create regexp literal if possible (estools#308)
to get around not serializable regexp the raw literal value should be used instead of the value FIX ISSUE estools#294
1 parent ba4faab commit 719de30

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

escodegen.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2331,6 +2331,9 @@
23312331
return expr.value ? 'true' : 'false';
23322332
}
23332333

2334+
if (expr.regex) {
2335+
return '/' + expr.regex.pattern + '/' + expr.regex.flags;
2336+
}
23342337
return generateRegExp(expr.value);
23352338
},
23362339

0 commit comments

Comments
 (0)