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

Added jsescOptions to Numeric Literals #11028

Merged
merged 9 commits into from Mar 16, 2020
6 changes: 5 additions & 1 deletion packages/babel-generator/src/generators/types.js
Expand Up @@ -120,7 +120,11 @@ export function NullLiteral() {

export function NumericLiteral(node: Object) {
const raw = this.getPossibleRaw(node);
const value = node.value + "";
const opts = this.format.jsescOption;
if (this.format.jsonCompatibleStrings) {
sidntrivedi012 marked this conversation as resolved.
Show resolved Hide resolved
opts.json = true;
}
const value = jsesc(node.value, opts);
sidntrivedi012 marked this conversation as resolved.
Show resolved Hide resolved
if (raw == null) {
this.number(value); // normalize
} else if (this.format.minified) {
Expand Down