How to use the regexpu/rewrite-pattern function in regexpu

To help you get started, we’ve selected a few regexpu examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github babel / babel / src / babel / transformation / transformers / es6 / unicode-regex.js View on Github external
export function Literal(node) {
  var regex = node.regex;
  if (!regex) return;

  var flags = regex.flags.split("");
  if (regex.flags.indexOf("u") < 0) return;
  pull(flags, "u");

  regex.pattern = rewritePattern(regex.pattern, regex.flags);
  regex.flags   = flags.join("");
}
github babel / babel / packages / babel-core / src / transformation / transformers / es6 / regex.unicode.js View on Github external
RegexLiteral(node) {
    if (!regex.is(node, "u")) return;
    node.regex.pattern = rewritePattern(node.pattern, node.flags);
    regex.pullFlag(node, "u");
  }
};

regexpu

A source code transpiler that enables the use of ES2015 Unicode regular expressions in ES5.

MIT
Latest version published 3 years ago

Package Health Score

54 / 100
Full package analysis