Skip to content

Commit

Permalink
StringNumericLiteral does not include NumericLiteralSeparator (#10938)
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung authored and nicolo-ribaudo committed Jan 10, 2020
1 parent 771c730 commit 7bc22e4
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 38 deletions.
16 changes: 0 additions & 16 deletions packages/babel-plugin-proposal-numeric-separator/src/index.js
@@ -1,30 +1,14 @@
import { declare } from "@babel/helper-plugin-utils";
import syntaxNumericSeparator from "@babel/plugin-syntax-numeric-separator";
import { types as t } from "@babel/core";

export default declare(api => {
api.assertVersion(7);

function replaceNumberArg({ node }) {
if (node.callee.name !== "Number") {
return;
}

const arg = node.arguments[0];
if (!t.isStringLiteral(arg)) {
return;
}

arg.value = arg.value.replace(/_/g, "");
}

return {
name: "proposal-numeric-separator",
inherits: syntaxNumericSeparator,

visitor: {
CallExpression: replaceNumberArg,
NewExpression: replaceNumberArg,
NumericLiteral({ node }) {
const { extra } = node;
if (extra && /_/.test(extra.raw)) {
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 7bc22e4

Please sign in to comment.