index.js 889 B

1234567891011121314151617181920212223242526272829
  1. "use strict";
  2. exports.__esModule = true;
  3. exports.default = function () {
  4. return {
  5. visitor: {
  6. RegExpLiteral: function RegExpLiteral(path) {
  7. 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 _babelHelperRegex = require("babel-helper-regex");
  15. var regex = _interopRequireWildcard(_babelHelperRegex);
  16. var _babelTypes = require("babel-types");
  17. var t = _interopRequireWildcard(_babelTypes);
  18. 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; } }
  19. module.exports = exports["default"];