You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
657 B

4 years ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.is = is;
  6. exports.pullFlag = pullFlag;
  7. function _pull() {
  8. const data = _interopRequireDefault(require("lodash/pull"));
  9. _pull = function () {
  10. return data;
  11. };
  12. return data;
  13. }
  14. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15. function is(node, flag) {
  16. return node.type === "RegExpLiteral" && node.flags.indexOf(flag) >= 0;
  17. }
  18. function pullFlag(node, flag) {
  19. const flags = node.flags.split("");
  20. if (node.flags.indexOf(flag) < 0) return;
  21. (0, _pull().default)(flags, flag);
  22. node.flags = flags.join("");
  23. }