Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
RegExpLiteral(path, state) {
const node = path.node;
if (!regex.is(node, 'u')) {
return;
}
const useUnicodeFlag = state.opts.useUnicodeFlag || false;
node.pattern = rewritePattern(node.pattern, node.flags, {
'unicodePropertyEscape': true,
'useUnicodeFlag': useUnicodeFlag
});
if (!useUnicodeFlag) {
regex.pullFlag(node, 'u');
}
}
}
RegExpLiteral(path) {
const { node } = path;
if (!regex.is(node, "y")) return;
path.replaceWith(
t.newExpression(t.identifier("RegExp"), [
t.stringLiteral(node.pattern),
t.stringLiteral(node.flags),
]),
);
},
},
RegExpLiteral({ node }) {
if (!regex.is(node, "u")) return;
node.pattern = rewritePattern(node.pattern, node.flags);
regex.pullFlag(node, "u");
},
},
RegExpLiteral(path) {
const { node } = path;
if (!regex.is(node, "y")) return;
path.replaceWith(
t.newExpression(t.identifier("RegExp"), [
t.stringLiteral(node.pattern),
t.stringLiteral(node.flags),
]),
);
},
},
RegExpLiteral(path, state) {
const node = path.node;
if (!regex.is(node, 'u')) {
return;
}
const useUnicodeFlag = state.opts.useUnicodeFlag || false;
node.pattern = rewritePattern(node.pattern, node.flags, {
'unicodePropertyEscape': true,
'useUnicodeFlag': useUnicodeFlag
});
if (!useUnicodeFlag) {
regex.pullFlag(node, 'u');
}
}
}
RegExpLiteral({ node }) {
if (!regex.is(node, "u")) return;
node.pattern = rewritePattern(node.pattern, node.flags);
regex.pullFlag(node, "u");
},
},