blob: 6755bbe8d2e7f83794ed8a7decd4642159d2c2e4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _helperPluginUtils() {
const data = require("@babel/helper-plugin-utils");
_helperPluginUtils = function _helperPluginUtils() {
return data;
};
return data;
}
function _pluginSyntaxNumericSeparator() {
const data = _interopRequireDefault(require("@babel/plugin-syntax-numeric-separator"));
_pluginSyntaxNumericSeparator = function _pluginSyntaxNumericSeparator() {
return data;
};
return data;
}
function _core() {
const data = require("@babel/core");
_core = function _core() {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = (0, _helperPluginUtils().declare)(api => {
api.assertVersion(7);
function replaceNumberArg({
node
}) {
if (node.callee.name !== "Number") {
return;
}
const arg = node.arguments[0];
if (!_core().types.isStringLiteral(arg)) {
return;
}
arg.value = arg.value.replace(/_/g, "");
}
return {
inherits: _pluginSyntaxNumericSeparator().default,
visitor: {
CallExpression: replaceNumberArg,
NewExpression: replaceNumberArg,
NumericLiteral({
node
}) {
const extra = node.extra;
if (extra && /_/.test(extra.raw)) {
extra.raw = extra.raw.replace(/_/g, "");
}
}
}
};
});
exports.default = _default;
|