Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
696 bytes
|
Line | |
---|
1 | "use strict";
|
---|
2 |
|
---|
3 | Object.defineProperty(exports, "__esModule", {
|
---|
4 | value: true
|
---|
5 | });
|
---|
6 | exports.default = void 0;
|
---|
7 |
|
---|
8 | var _helperPluginUtils = require("@babel/helper-plugin-utils");
|
---|
9 |
|
---|
10 | var _core = require("@babel/core");
|
---|
11 |
|
---|
12 | var _default = (0, _helperPluginUtils.declare)(api => {
|
---|
13 | api.assertVersion(7);
|
---|
14 | return {
|
---|
15 | name: "transform-sticky-regex",
|
---|
16 | visitor: {
|
---|
17 | RegExpLiteral(path) {
|
---|
18 | const {
|
---|
19 | node
|
---|
20 | } = path;
|
---|
21 | if (!node.flags.includes("y")) return;
|
---|
22 | path.replaceWith(_core.types.newExpression(_core.types.identifier("RegExp"), [_core.types.stringLiteral(node.pattern), _core.types.stringLiteral(node.flags)]));
|
---|
23 | }
|
---|
24 |
|
---|
25 | }
|
---|
26 | };
|
---|
27 | });
|
---|
28 |
|
---|
29 | exports.default = _default; |
---|
Note:
See
TracBrowser
for help on using the repository browser.