Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StringNumericLiteral does not include NumericLiteralSeparator #10938

Merged
merged 1 commit into from Jan 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.