Permalink
Browse files

Support decimals without any decimal digits

Fixes #46.
Closes #58.
  • Loading branch information...
wyozi authored and mathiasbynens committed Oct 2, 2018
1 parent ba4c54b commit 025594919d695ae8fd2b68c7c213cb5a26d30a3a
Showing with 15 additions and 0 deletions.
  1. +5 −0 luamin.js
  2. +10 −0 tests/tests.js
@@ -201,6 +201,11 @@
// e.g. `1-` + `-2`
return a + separator + b;
}
var secondLastCharA = a.slice(-2, -1);
if (lastCharA == '.' && secondLastCharA != '.' && regexAlphaNumUnderscore.test(firstCharB)) {
// e.g. `1.` + `print`
return a + separator + b;
}
return a + b;
};

@@ -1023,6 +1023,16 @@
'original': 'a = .1',
'minified': 'a=.1'
},
{
'description': 'NumericLiteral',
'original': 'a = 1.',
'minified': 'a=1.'
},
{
'description': 'NumericLiteral + Any Statement',
'original': 'a = 1.;b=2',
'minified': 'a=1.;b=2'
},
{
'description': 'NumericLiteral',
'original': 'a = 1.1',

0 comments on commit 0255949

Please sign in to comment.