fela-plugin-unit
Advanced tools
Comparing version 4.1.2 to 4.2.0
@@ -96,19 +96,2 @@ (function (global, factory) { | ||
/* weak */ | ||
var warning = function warning() { | ||
return true; | ||
}; | ||
if (true) { | ||
warning = function warning(condition, message) { | ||
if (!condition) { | ||
if (typeof console !== 'undefined') { | ||
console.error(message); // eslint-disable-line | ||
} | ||
} | ||
}; | ||
} | ||
var warning$1 = warning; | ||
var index$1 = __commonjs(function (module) { | ||
@@ -202,9 +185,27 @@ 'use strict'; | ||
/* weak */ | ||
/* eslint-disable import/no-mutable-exports */ | ||
var warning = function warning() { | ||
return true; | ||
}; | ||
if (true) { | ||
warning = function warning(condition, message) { | ||
if (!condition) { | ||
if (typeof console !== 'undefined') { | ||
console.error(message); // eslint-disable-line | ||
} | ||
} | ||
}; | ||
} | ||
var warning$1 = warning; | ||
function addUnitIfNeeded(property, value, unit) { | ||
var valueType = typeof value === 'undefined' ? 'undefined' : babelHelpers.typeof(value); | ||
/* eslint-disable eqeqeq */ | ||
if (valueType === 'number' || valueType === 'string' && value == parseFloat(value)) { | ||
// eslint-disable-line | ||
value += unit; | ||
} | ||
/* eslint-enable */ | ||
return value; | ||
@@ -217,13 +218,12 @@ } | ||
(function () { | ||
var value = style[property]; | ||
var cssValue = style[property]; | ||
var propertyUnit = propertyMap[property] || unit; | ||
if (Array.isArray(value)) { | ||
style[property] = value.map(function (value) { | ||
return addUnitIfNeeded(property, value, propertyUnit); | ||
if (Array.isArray(cssValue)) { | ||
style[property] = cssValue.map(function (val) { | ||
return addUnitIfNeeded(property, val, propertyUnit); | ||
}); | ||
} else if (value instanceof Object) { | ||
style[property] = addUnit(value, unit, propertyMap); | ||
} else if (cssValue instanceof Object) { | ||
style[property] = addUnit(cssValue, unit, propertyMap); | ||
} else { | ||
style[property] = addUnitIfNeeded(property, value, propertyUnit); | ||
style[property] = addUnitIfNeeded(property, cssValue, propertyUnit); | ||
} | ||
@@ -245,3 +245,3 @@ })(); | ||
warning$1(unit.match(/ch|em|ex|rem|vh|vw|vmin|vmax|px|cm|mm|in|pc|pt|mozmm|%/) !== null, 'You are using an invalid unit `' + unit + '`. Consider using one of the following ch, em, ex, rem, vh, vw, vmin, vmax, px, cm, mm, in, pc, pt, mozmm or %.'); | ||
warning$1(unit.match(/ch|em|ex|rem|vh|vw|vmin|vmax|px|cm|mm|in|pc|pt|mozmm|%/) !== null, 'You are using an invalid unit `' + unit + '`.\n Consider using one of the following ch, em, ex, rem, vh, vw, vmin, vmax, px, cm, mm, in, pc, pt, mozmm or %.'); | ||
@@ -248,0 +248,0 @@ return function (style) { |
{ | ||
"name": "fela-plugin-unit", | ||
"version": "4.1.2", | ||
"version": "4.2.0", | ||
"description": "Fela plugin to automatically add units if required", | ||
@@ -24,4 +24,4 @@ "main": "index.js", | ||
"peerDependencies": { | ||
"fela": "4.1.2" | ||
"fela": "4.2.0" | ||
} | ||
} |
@@ -18,5 +18,5 @@ # fela-plugin-unit | ||
<!-- Fela (Development): Unminified version including all warnings --> | ||
<script src="https://unpkg.com/fela-plugin-unit@4.1.2/dist/fela-plugin-unit.js"></script> | ||
<script src="https://unpkg.com/fela-plugin-unit@4.2.0/dist/fela-plugin-unit.js"></script> | ||
<!-- Fela (Production): Minified version --> | ||
<script src="https://unpkg.com/fela-plugin-unit@4.1.2/dist/fela-plugin-unit.min.js"></script> | ||
<script src="https://unpkg.com/fela-plugin-unit@4.2.0/dist/fela-plugin-unit.min.js"></script> | ||
``` | ||
@@ -23,0 +23,0 @@ |
Sorry, the diff of this file is not supported yet
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
22535
208