1 |
3a515b92
|
cagy
|
"use strict";
|
2 |
|
|
|
3 |
|
|
exports.__esModule = true;
|
4 |
|
|
exports.is = is;
|
5 |
|
|
exports.pullFlag = pullFlag;
|
6 |
|
|
|
7 |
|
|
var _pull = require("lodash/pull");
|
8 |
|
|
|
9 |
|
|
var _pull2 = _interopRequireDefault(_pull);
|
10 |
|
|
|
11 |
|
|
var _babelTypes = require("babel-types");
|
12 |
|
|
|
13 |
|
|
var t = _interopRequireWildcard(_babelTypes);
|
14 |
|
|
|
15 |
|
|
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; } }
|
16 |
|
|
|
17 |
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
18 |
|
|
|
19 |
|
|
function is(node, flag) {
|
20 |
|
|
return t.isRegExpLiteral(node) && node.flags.indexOf(flag) >= 0;
|
21 |
|
|
}
|
22 |
|
|
|
23 |
|
|
function pullFlag(node, flag) {
|
24 |
|
|
var flags = node.flags.split("");
|
25 |
|
|
if (node.flags.indexOf(flag) < 0) return;
|
26 |
|
|
(0, _pull2.default)(flags, flag);
|
27 |
|
|
node.flags = flags.join("");
|
28 |
|
|
}
|