Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getTranslatedData(regexp, state) {
let whitelist = undefined;
if (Array.isArray(state.opts.features) && state.opts.features.length > 0) {
whitelist = state.opts.features;
}
const compat = regexpTree.compatTranspile(regexp, whitelist);
return {
pattern: compat.getSource(),
flags: compat.getFlags(),
};
}