postcss-convert-values
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -0,1 +1,6 @@ | ||
# 1.2.1 | ||
* Fixes regressions introduced by the previous patch. Better support for | ||
negative value transforms. | ||
# 1.2.0 | ||
@@ -2,0 +7,0 @@ |
@@ -22,2 +22,6 @@ 'use strict'; | ||
if (value[0] === '-' && value[1] === '0' && number % 1) { | ||
return '-' + value.substring(2); | ||
} | ||
return value; | ||
@@ -27,3 +31,4 @@ } | ||
module.exports = function (number, unit) { | ||
var value, | ||
var converted, | ||
value = dropLeadingZero(number) + (unit ? unit : ''), | ||
conversion, | ||
@@ -39,3 +44,6 @@ base; | ||
return Object.keys(conversion) | ||
converted = Object.keys(conversion) | ||
.filter(function (u) { | ||
return unit !== u; | ||
}) | ||
.map(function (u) { | ||
@@ -47,5 +55,9 @@ return dropLeadingZero(base / conversion[u]) + u; | ||
}); | ||
if (converted.length < value.length) { | ||
value = converted; | ||
} | ||
} | ||
return dropLeadingZero(number) + (unit ? unit : ''); | ||
return value; | ||
}; |
{ | ||
"name": "postcss-convert-values", | ||
"version": "1.2.0", | ||
"version": "1.2.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
7359
107