Socket
Socket
Sign inDemoInstall

postcss-normalize-positions

Package Overview
Dependencies
Maintainers
4
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-normalize-positions - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

33

dist/index.js

@@ -47,3 +47,3 @@ 'use strict';

arg.forEach((part, index) => {
const isPosition = ~directions.indexOf(part.value) || (0, _postcssValueParser.unit)(part.value);
const isPosition = ~directions.indexOf(part.value.toLowerCase()) || (0, _postcssValueParser.unit)(part.value);
const len = relevant.length - 1;

@@ -74,31 +74,30 @@ if (relevant[len].start === null && isPosition) {

}
if (position.length === 1 || position[2].value === 'center') {
if (position[2]) {
const firstValue = position[0].value.toLowerCase();
const secondValue = position[2] && position[2].value ? position[2].value.toLowerCase() : null;
if (position.length === 1 || secondValue === 'center') {
if (secondValue) {
position[2].value = position[1].value = '';
}
const { value } = position[0];
const map = Object.assign({}, horizontal, {
center
});
if ((0, _has2.default)(map, value)) {
position[0].value = map[value];
if ((0, _has2.default)(map, firstValue)) {
position[0].value = map[firstValue];
}
return;
}
if (position[0].value === 'center' && ~directions.indexOf(position[2].value)) {
if (firstValue === 'center' && ~directions.indexOf(secondValue)) {
position[0].value = position[1].value = '';
const { value } = position[2];
if ((0, _has2.default)(horizontal, value)) {
position[2].value = horizontal[value];
if ((0, _has2.default)(horizontal, secondValue)) {
position[2].value = horizontal[secondValue];
}
return;
}
if ((0, _has2.default)(horizontal, position[0].value) && (0, _has2.default)(vertical, position[2].value)) {
position[0].value = horizontal[position[0].value];
position[2].value = vertical[position[2].value];
if ((0, _has2.default)(horizontal, firstValue) && (0, _has2.default)(vertical, secondValue)) {
position[0].value = horizontal[firstValue];
position[2].value = vertical[secondValue];
return;
} else if ((0, _has2.default)(vertical, position[0].value) && (0, _has2.default)(horizontal, position[2].value)) {
let first = position[0].value;
position[0].value = horizontal[position[2].value];
position[2].value = vertical[first];
} else if ((0, _has2.default)(vertical, firstValue) && (0, _has2.default)(horizontal, secondValue)) {
position[0].value = horizontal[secondValue];
position[2].value = vertical[firstValue];
return;

@@ -105,0 +104,0 @@ }

{
"name": "postcss-normalize-positions",
"version": "4.0.0",
"version": "4.0.1",
"description": "Normalize keyword values for position into length values.",

@@ -33,3 +33,3 @@ "main": "dist/index.js",

"has": "^1.0.0",
"postcss": "^6.0.0",
"postcss": "^7.0.0",
"postcss-value-parser": "^3.0.0"

@@ -36,0 +36,0 @@ },

@@ -19,3 +19,3 @@ # [postcss][postcss]-normalize-positions

div {
background-position: bottom right
background-position: bottom left;
}

@@ -28,3 +28,3 @@ ```

div {
background-position: 100% 100%
background-position:0 100%;
}

@@ -31,0 +31,0 @@ ```

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