index.js 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. /*istanbul ignore next*/"use strict";
  2. exports.__esModule = true;
  3. exports.default = function () {
  4. return {
  5. visitor: { /*istanbul ignore next*/
  6. RegExpLiteral: function RegExpLiteral(path) {
  7. /*istanbul ignore next*/var node = path.node;
  8. if (!regex.is(node, "y")) return;
  9. path.replaceWith(t.newExpression(t.identifier("RegExp"), [t.stringLiteral(node.pattern), t.stringLiteral(node.flags)]));
  10. }
  11. }
  12. };
  13. };
  14. var /*istanbul ignore next*/_babelHelperRegex = require("babel-helper-regex");
  15. /*istanbul ignore next*/
  16. var regex = _interopRequireWildcard(_babelHelperRegex);
  17. var /*istanbul ignore next*/_babelTypes = require("babel-types");
  18. /*istanbul ignore next*/
  19. var t = _interopRequireWildcard(_babelTypes);
  20. /*istanbul ignore next*/
  21. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  22. module.exports = exports["default"];