regexp-unsupported-ncg.js 415 B

123456789101112
  1. 'use strict';
  2. var fails = require('../internals/fails');
  3. var globalThis = require('../internals/global-this');
  4. // babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
  5. var $RegExp = globalThis.RegExp;
  6. module.exports = fails(function () {
  7. var re = $RegExp('(?<a>b)', 'g');
  8. return re.exec('b').groups.a !== 'b' ||
  9. 'b'.replace(re, '$<a>c') !== 'bc';
  10. });