Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fela-plugin-unit

Package Overview
Dependencies
Maintainers
2
Versions
111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fela-plugin-unit - npm Package Compare versions

Comparing version 5.0.17 to 5.1.0

9

es/index.js
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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc