fela-plugin-unit
Advanced tools
Comparing version 5.0.17 to 5.1.0
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
import isUnitlessProperty from 'css-in-js-utils/lib/isUnitlessProperty'; | ||
import defaultIsUnitlessProperty from 'css-in-js-utils/lib/isUnitlessProperty'; | ||
import isPlainObject from 'isobject'; | ||
@@ -16,3 +16,3 @@ | ||
function addUnit(style, defaultUnit, propertyMap) { | ||
function addUnit(style, defaultUnit, propertyMap, isUnitlessProperty) { | ||
var _loop = function _loop(property) { | ||
@@ -24,3 +24,3 @@ if (!isUnitlessProperty(property)) { | ||
if (isPlainObject(cssValue)) { | ||
style[property] = addUnit(cssValue, defaultUnit, propertyMap); | ||
style[property] = addUnit(cssValue, defaultUnit, propertyMap, isUnitlessProperty); | ||
} else if (Array.isArray(cssValue)) { | ||
@@ -46,6 +46,7 @@ style[property] = cssValue.map(function (val) { | ||
var propertyMap = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var isUnitlessProperty = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultIsUnitlessProperty; | ||
return function (style) { | ||
return addUnit(style, defaultUnit, propertyMap); | ||
return addUnit(style, defaultUnit, propertyMap, isUnitlessProperty); | ||
}; | ||
} |
@@ -31,5 +31,5 @@ 'use strict'; | ||
function addUnit(style, defaultUnit, propertyMap) { | ||
function addUnit(style, defaultUnit, propertyMap, isUnitlessProperty) { | ||
var _loop = function _loop(property) { | ||
if (!(0, _isUnitlessProperty2.default)(property)) { | ||
if (!isUnitlessProperty(property)) { | ||
var cssValue = style[property]; | ||
@@ -39,3 +39,3 @@ var propertyUnit = propertyMap[property] || defaultUnit; | ||
if ((0, _isobject2.default)(cssValue)) { | ||
style[property] = addUnit(cssValue, defaultUnit, propertyMap); | ||
style[property] = addUnit(cssValue, defaultUnit, propertyMap, isUnitlessProperty); | ||
} else if (Array.isArray(cssValue)) { | ||
@@ -61,6 +61,7 @@ style[property] = cssValue.map(function (val) { | ||
var propertyMap = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var isUnitlessProperty = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _isUnitlessProperty2.default; | ||
return function (style) { | ||
return addUnit(style, defaultUnit, propertyMap); | ||
return addUnit(style, defaultUnit, propertyMap, isUnitlessProperty); | ||
}; | ||
} |
{ | ||
"name": "fela-plugin-unit", | ||
"version": "5.0.17", | ||
"version": "5.1.0", | ||
"description": "Fela plugin to automatically add units if required", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -34,2 +34,3 @@ # fela-plugin-unit | ||
| unitPerProperty | *(Object)* | `{}` | Default units per property | | ||
| isUnitlessProperty | *(Function)* | [`util function`](https://github.com/rofrischmann/css-in-js-utils/blob/master/modules/isUnitlessProperty.js) | check whether property should remain unitless | | ||
@@ -36,0 +37,0 @@ ##### Example |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
8028
88
82
0