Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function pryRegExASTFromInput(pRegEx) {
let lRegExp = null;
if (pRegEx instanceof RegExp) {
lRegExp = pRegEx;
} else if (typeof pRegEx === "string") {
lRegExp = new RegExp(pRegEx);
} else {
lRegExp = new RegExp(String(pRegEx));
}
// Build an AST
return regexpTree.parse(lRegExp);
}