Skip to content

Instantly share code, notes, and snippets.

@mattiamanzati
Created December 2, 2023 09:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattiamanzati/3a4592c299f0d379e6d857ab20c9353b to your computer and use it in GitHub Desktop.
Save mattiamanzati/3a4592c299f0d379e6d857ab20c9353b to your computer and use it in GitHub Desktop.
const syntaxBigInt = require("@babel/plugin-syntax-bigint").default
module.exports = function (babel) {
const types = babel.types
const visitor = {
BigIntLiteral(path) {
const value = path.node.value
path.replaceWith(
types.callExpression(types.identifier("BigInt"), [types.StringLiteral(value)])
)
}
}
return {
inherits: syntaxBigInt,
visitor: {
...visitor
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment