question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[babel-generator]: jsescOption.numbers does not affect NumericLiterals

See original GitHub issue

Bug Report

  • I would like to work on a fix!

Current Behavior Currently, when I set:

{
    jsescOption: {
        numbers: 'hexadecimal'
    }
}

This option has not affects any numbers that @babel/generator is generated.

For example i need the following in the output generated code:

var foo = 0x1;

Expected behavior/code

{
    jsescOption: {
        numbers: 'hexadecimal'
    }
}

This option should affect any numbers that @babel/generator is generated

Possible Solution Looks like here: https://github.com/babel/babel/blob/master/packages/babel-generator/src/generators/types.js#L121 number value should be generated using jsesc like in StringLiteral

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
sanex3339commented, Jan 17, 2020

Set the options as descrived above.

With these options, all numbers should be generated in hexadecimal view: 0 -> 0x0

1reaction
sidntrivedi012commented, Jan 17, 2020

@nicolo-ribaudo I would like to work on this. Can you please guide how to proceed? Thanks 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

babel/generator - Babel.js
When Babel generator prints code from the AST, the output format is not guaranteed ... to numbers only if jsescOption.numbers (added in v7.9.0...
Read more >
https://raw.githubusercontent.com/assemblylanguage...
This devtool is not neither made for production nor for readable output files. ... Converting the array of base-26 numbers into the characters...
Read more >
基础包制作 (b6bba109) · Commits · 徐俊 / yungu_node_modules ...
If the column number is not known, you may omit it. ... retainLines | boolean | `false` | Attempt to use the same...
Read more >
Package Diff: tap @ 14.10.7 .. 14.10.8
Visual diff of the npm package 'tap' comparing 14.10.7 with 14.10.8.
Read more >
chore: add cloudbase · 123bb319aa - omi - Gitea Yiem
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found