Void if precision value is not a number
authorvlakoff <vlakoff@gmail.com>
Sat, 29 Oct 2016 08:10:26 +0000 (10:10 +0200)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Tue, 1 Nov 2016 06:52:11 +0000 (07:52 +0100)
lib/selectors/simple.js

index 5b8b339..5e6fd3c 100644 (file)
@@ -86,7 +86,7 @@ function whitespaceMinifier(name, value) {
 }
 
 function precisionMinifier(_, value, precisionOptions) {
-  if (precisionOptions.value === -1 || value.indexOf('.') === -1)
+  if (precisionOptions.value === -1 || isNaN(precisionOptions.value) || value.indexOf('.') === -1)
     return value;
 
   return value
@@ -394,6 +394,10 @@ function buildPrecision(options) {
   precision.value = options.roundingPrecision === undefined ?
     DEFAULT_ROUNDING_PRECISION :
     parseInt(options.roundingPrecision);
+
+  if (isNaN(precision.value))
+    return precision;
+
   precision.multiplier = Math.pow(10, precision.value);
   precision.regexp = new RegExp('(\\d*\\.\\d{' + (precision.value + 1) + ',})px', 'g');