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

fela-plugin-extend

Package Overview
Dependencies
Maintainers
2
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fela-plugin-extend - npm Package Compare versions

Comparing version 6.0.9 to 6.0.10

23

es/index.js
import objectEach from 'fast-loops/lib/objectEach';
import arrayEach from 'fast-loops/lib/arrayEach';
import assignStyle from 'css-in-js-utils/lib/assignStyle';
import isPlainObject from 'isobject';
import { isUndefinedValue } from 'fela-utils';
function removeUndefined(style) {
objectEach(style, function (value, key) {
objectEach(style, function (value, property) {
if (isPlainObject(value)) {
style[key] = removeUndefined(value);
style[property] = removeUndefined(value);
} else if (Array.isArray(value)) {
style[key] = value.filter(function (val) {
style[property] = value.filter(function (val) {
return !isUndefinedValue(val);
});
} else if (isUndefinedValue(value)) {
delete style[key];
delete style[property];
}
});
return style;
}
function extendStyle(style, extension, extendPlugin, type, renderer) {
function extendStyle(style, extension) {
// extend conditional style objects
if (extension.hasOwnProperty('condition')) {
if (extension.condition) {
renderer._mergeStyle(style, extendPlugin(extension.style, type, renderer));
assignStyle(style, extend(extension.style));
}
} else {
// extend basic style objects
renderer._mergeStyle(style, removeUndefined(extension));
assignStyle(style, removeUndefined(extension));
}
}
function extend(style, type, renderer) {
function extend(style) {
objectEach(style, function (value, property) {

@@ -39,3 +42,3 @@ if (property === 'extend') {

arrayEach(extensions, function (extension) {
return extendStyle(style, extension, extend, type, renderer);
return extendStyle(style, extension);
});

@@ -45,3 +48,3 @@ delete style[property];

// support nested extend as well
style[property] = extend(value, type, renderer);
style[property] = extend(value);
}

@@ -48,0 +51,0 @@ });

@@ -15,2 +15,6 @@ 'use strict';

var _assignStyle = require('css-in-js-utils/lib/assignStyle');
var _assignStyle2 = _interopRequireDefault(_assignStyle);
var _isobject = require('isobject');

@@ -25,29 +29,31 @@

function removeUndefined(style) {
(0, _objectEach2.default)(style, function (value, key) {
(0, _objectEach2.default)(style, function (value, property) {
if ((0, _isobject2.default)(value)) {
style[key] = removeUndefined(value);
style[property] = removeUndefined(value);
} else if (Array.isArray(value)) {
style[key] = value.filter(function (val) {
style[property] = value.filter(function (val) {
return !(0, _felaUtils.isUndefinedValue)(val);
});
} else if ((0, _felaUtils.isUndefinedValue)(value)) {
delete style[key];
delete style[property];
}
});
return style;
}
function extendStyle(style, extension, extendPlugin, type, renderer) {
function extendStyle(style, extension) {
// extend conditional style objects
if (extension.hasOwnProperty('condition')) {
if (extension.condition) {
renderer._mergeStyle(style, extendPlugin(extension.style, type, renderer));
(0, _assignStyle2.default)(style, extend(extension.style));
}
} else {
// extend basic style objects
renderer._mergeStyle(style, removeUndefined(extension));
(0, _assignStyle2.default)(style, removeUndefined(extension));
}
}
function extend(style, type, renderer) {
function extend(style) {
(0, _objectEach2.default)(style, function (value, property) {

@@ -58,3 +64,3 @@ if (property === 'extend') {

(0, _arrayEach2.default)(extensions, function (extension) {
return extendStyle(style, extension, extend, type, renderer);
return extendStyle(style, extension);
});

@@ -64,3 +70,3 @@ delete style[property];

// support nested extend as well
style[property] = extend(value, type, renderer);
style[property] = extend(value);
}

@@ -67,0 +73,0 @@ });

{
"name": "fela-plugin-extend",
"version": "6.0.9",
"version": "6.0.10",
"description": "Fela plugin to extend style objects",

@@ -26,6 +26,7 @@ "main": "lib/index.js",

"dependencies": {
"css-in-js-utils": "^3.0.0",
"fast-loops": "^1.0.0",
"fela-utils": "^8.1.1",
"fela-utils": "^8.1.2",
"isobject": "^3.0.1"
}
}
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