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

inline-style-expand-shorthand

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inline-style-expand-shorthand - npm Package Compare versions

Comparing version 1.1.5 to 1.2.0

14

es/expand.js

@@ -15,8 +15,16 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

}
} else if (_typeof(value) === 'object') {
if (Array.isArray(value)) {
} else if (value === null) {// should skip
} else if (Array.isArray(value)) {
if (property === 'extend') {
value.map(expand);
} else {
expand(value);
var _expansion = expandProperty(property, value);
if (_expansion) {
Object.assign(style, _expansion);
delete style[property];
}
}
} else if (_typeof(value) === 'object') {
expand(value);
}

@@ -23,0 +31,0 @@ }

@@ -127,3 +127,3 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

export default function expandProperty(property, value) {
function expandProperty(property, value) {
// special expansion for the border property as its 2 levels deep

@@ -154,2 +154,26 @@ if (property === 'border') {

}
}
export default function preExpand(property, value) {
if (Array.isArray(value)) {
var result = {};
value.forEach(function (item) {
var itemResult = expandProperty(property, item);
if (itemResult) {
Object.keys(itemResult).forEach(function (itemProperty) {
result[itemProperty] = result[itemProperty] || [];
result[itemProperty].push(itemResult[itemProperty]);
});
}
});
if (Object.keys(result).length) {
return result;
}
return null;
}
return expandProperty(property, value);
}

@@ -39,8 +39,15 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

} else if (value === null) {// should skip
} else if (_typeof(value) === 'object') {
if (Array.isArray(value)) {
} else if (Array.isArray(value)) {
if (property === 'extend') {
value.map(expandWithMerge);
} else {
expandWithMerge(value);
var _expansion = expandProperty(property, value);
if (_expansion) {
Object.assign(style, mergeBase(_expansion, style));
delete style[property];
}
}
} else if (_typeof(value) === 'object') {
expandWithMerge(value);
}

@@ -47,0 +54,0 @@ }

@@ -25,8 +25,16 @@ "use strict";

}
} else if (_typeof(value) === 'object') {
if (Array.isArray(value)) {
} else if (value === null) {// should skip
} else if (Array.isArray(value)) {
if (property === 'extend') {
value.map(expand);
} else {
expand(value);
var _expansion = (0, _expandProperty["default"])(property, value);
if (_expansion) {
Object.assign(style, _expansion);
delete style[property];
}
}
} else if (_typeof(value) === 'object') {
expand(value);
}

@@ -33,0 +41,0 @@ }

@@ -6,3 +6,3 @@ "use strict";

});
exports["default"] = expandProperty;
exports["default"] = preExpand;

@@ -161,2 +161,26 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

}
}
function preExpand(property, value) {
if (Array.isArray(value)) {
var result = {};
value.forEach(function (item) {
var itemResult = expandProperty(property, item);
if (itemResult) {
Object.keys(itemResult).forEach(function (itemProperty) {
result[itemProperty] = result[itemProperty] || [];
result[itemProperty].push(itemResult[itemProperty]);
});
}
});
if (Object.keys(result).length) {
return result;
}
return null;
}
return expandProperty(property, value);
}

@@ -49,8 +49,15 @@ "use strict";

} else if (value === null) {// should skip
} else if (_typeof(value) === 'object') {
if (Array.isArray(value)) {
} else if (Array.isArray(value)) {
if (property === 'extend') {
value.map(expandWithMerge);
} else {
expandWithMerge(value);
var _expansion = (0, _expandProperty["default"])(property, value);
if (_expansion) {
Object.assign(style, mergeBase(_expansion, style));
delete style[property];
}
}
} else if (_typeof(value) === 'object') {
expandWithMerge(value);
}

@@ -57,0 +64,0 @@ }

{
"name": "inline-style-expand-shorthand",
"version": "1.1.5",
"version": "1.2.0",
"repository": "https://github.com/rofrischmann/inline-style-expand-shorthand.git",

@@ -5,0 +5,0 @@ "author": "rofrischmann <robin@rofrischmann.de>",

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