Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

only add a second dot in forms like (5).toFixed() if the number is in…

…teger.

That is, the correct transformation for (0.9).toFixed() is .9.toFixed()
(fixes #109)
  • Loading branch information...
commit 3b1eee21d0c672ddab4d48703bd16a2a445f7b89 1 parent a55ed6f
@mishoo mishoo authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/process.js
View
7 lib/process.js
@@ -1256,9 +1256,10 @@ function gen_code(ast, options) {
},
"dot": function(expr) {
var out = make(expr), i = 1;
- if (expr[0] == "num")
- out += ".";
- else if (needs_parens(expr))
+ if (expr[0] == "num") {
+ if (!/\./.test(expr[1]))
+ out += ".";
+ } else if (needs_parens(expr))
out = "(" + out + ")";
while (i < arguments.length)
out += "." + make_name(arguments[i++]);
Please sign in to comment.
Something went wrong with that request. Please try again.