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-rc.2 to 4.0.0

46

dist/index.js

@@ -23,7 +23,7 @@ 'use strict';

var directions = ['top', 'right', 'bottom', 'left', 'center'];
const directions = ['top', 'right', 'bottom', 'left', 'center'];
var center = '50%';
const center = '50%';
var horizontal = {
const horizontal = {
right: '100%',

@@ -33,3 +33,3 @@ left: '0'

var vertical = {
const vertical = {
bottom: '100%',

@@ -40,6 +40,6 @@ top: '0'

function transform(decl) {
var values = (0, _postcssValueParser2.default)(decl.value);
var args = (0, _cssnanoUtilGetArguments2.default)(values);
var relevant = [];
args.forEach(function (arg) {
const values = (0, _postcssValueParser2.default)(decl.value);
const args = (0, _cssnanoUtilGetArguments2.default)(values);
const relevant = [];
args.forEach(arg => {
relevant.push({

@@ -49,5 +49,5 @@ start: null,

});
arg.forEach(function (part, index) {
var isPosition = ~directions.indexOf(part.value) || (0, _postcssValueParser.unit)(part.value);
var len = relevant.length - 1;
arg.forEach((part, index) => {
const isPosition = ~directions.indexOf(part.value) || (0, _postcssValueParser.unit)(part.value);
const len = relevant.length - 1;
if (relevant[len].start === null && isPosition) {

@@ -69,7 +69,7 @@ relevant[len].start = index;

});
relevant.forEach(function (range, index) {
relevant.forEach((range, index) => {
if (range.start === null) {
return;
}
var position = args[index].slice(range.start, range.end + 1);
const position = args[index].slice(range.start, range.end + 1);
if (position.length > 3) {

@@ -82,5 +82,4 @@ return;

}
var value = position[0].value;
var map = Object.assign({}, horizontal, {
const { value } = position[0];
const map = Object.assign({}, horizontal, {
center

@@ -95,6 +94,5 @@ });

position[0].value = position[1].value = '';
var _value = position[2].value;
if ((0, _has2.default)(horizontal, _value)) {
position[2].value = horizontal[_value];
const { value } = position[2];
if ((0, _has2.default)(horizontal, value)) {
position[2].value = horizontal[value];
}

@@ -108,3 +106,3 @@ return;

} else if ((0, _has2.default)(vertical, position[0].value) && (0, _has2.default)(horizontal, position[2].value)) {
var first = position[0].value;
let first = position[0].value;
position[0].value = horizontal[position[2].value];

@@ -118,7 +116,5 @@ position[2].value = vertical[first];

exports.default = (0, _postcss.plugin)('postcss-normalize-positions', function () {
return function (css) {
return css.walkDecls(/^(background(-position)?|(-webkit-)?perspective-origin)$/i, transform);
};
exports.default = (0, _postcss.plugin)('postcss-normalize-positions', () => {
return css => css.walkDecls(/^(background(-position)?|(-webkit-)?perspective-origin)$/i, transform);
});
module.exports = exports['default'];
{
"name": "postcss-normalize-positions",
"version": "4.0.0-rc.2",
"version": "4.0.0",
"description": "Normalize keyword values for position into length values.",

@@ -21,5 +21,5 @@ "main": "dist/index.js",

"babel-cli": "^6.0.0",
"cross-env": "^3.0.0"
"cross-env": "^5.0.0"
},
"homepage": "https://github.com/ben-eb/cssnano",
"homepage": "https://github.com/cssnano/cssnano",
"author": {

@@ -30,5 +30,5 @@ "name": "Ben Briggs",

},
"repository": "ben-eb/cssnano",
"repository": "cssnano/cssnano",
"dependencies": {
"cssnano-util-get-arguments": "^4.0.0-rc.2",
"cssnano-util-get-arguments": "^4.0.0",
"has": "^1.0.0",

@@ -39,7 +39,7 @@ "postcss": "^6.0.0",

"bugs": {
"url": "https://github.com/ben-eb/cssnano/issues"
"url": "https://github.com/cssnano/cssnano/issues"
},
"engines": {
"node": ">=4"
"node": ">=6.9.0"
}
}

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

See [CONTRIBUTORS.md](https://github.com/ben-eb/cssnano/blob/master/CONTRIBUTORS.md).
See [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).

@@ -41,0 +41,0 @@ ## License

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