reduce-css-calc
Advanced tools
Comparing version
@@ -0,1 +1,6 @@ | ||
# 1.2.3 - 2016-04-28 | ||
- Fixed: wrong rouding in some edge cases | ||
([#10](https://github.com/MoOx/reduce-css-calc/pull/10)) | ||
# 1.2.2 - 2016-04-19 | ||
@@ -2,0 +7,0 @@ |
@@ -64,2 +64,3 @@ /** | ||
// Convert percentages to numbers, to handle expressions like: 50% * 50% (will become: 25%): | ||
// console.log(expression) | ||
expression = expression.replace(/\b[0-9\.]+%/g, function(percent) { | ||
@@ -88,3 +89,5 @@ return parseFloat(percent.slice(0, -1)) * 0.01 | ||
// (0.1 * 0.2 === 0.020000000000000004) | ||
result = Math.round(result * decimalPrecision) / decimalPrecision | ||
if (functionIdentifier.length || unit === "%") { | ||
result = Math.round(result * decimalPrecision) / decimalPrecision | ||
} | ||
@@ -91,0 +94,0 @@ // We don't need units for zero values... |
{ | ||
"name": "reduce-css-calc", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"description": "Reduce CSS calc() function to the maximum", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
8690
2.57%130
2.36%