Merge pull request #2499 from amaanq/flags-if-exist

fix: don't add flags if they're not present
This commit is contained in:
Amaan Qureshi 2023-08-13 19:34:15 -04:00 committed by GitHub
commit 14cd76c354
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -181,10 +181,13 @@ function normalize(value) {
value
};
case RegExp:
return {
return value.flags ? {
type: 'PATTERN',
value: value.source,
flags: value.flags
} : {
type: 'PATTERN',
value: value.source
};
case ReferenceError:
throw value