postcss-convert-values
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -0,1 +1,6 @@ | ||
# 1.1.1 | ||
* Fixes an issue where trailing zeroes were not being removed in | ||
values that were not `0`. | ||
# 1.1.0 | ||
@@ -2,0 +7,0 @@ |
19
index.js
@@ -23,10 +23,15 @@ 'use strict'; | ||
if (length.test(value)) { | ||
var isZero = false; | ||
value = value.replace(length, function (_, num, unit) { | ||
isZero = parseFloat(num) === 0; | ||
return converter(num, unit); | ||
}); | ||
if (!~prop.indexOf('flex') && isZero) { | ||
return '0'; | ||
var match = value.match(length), | ||
num = match[1], | ||
integer = parseInt(num), | ||
unit = match[2]; | ||
if (parseFloat(num) === integer) { | ||
num = integer; | ||
} | ||
if (num !== 0) { | ||
num = converter(num, unit); | ||
} else if (~prop.indexOf('flex')) { | ||
return value; | ||
} | ||
return num; | ||
} | ||
@@ -33,0 +38,0 @@ return value; |
{ | ||
"name": "postcss-convert-values", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Convert values with PostCSS (e.g. ms -> s)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6743
101