postcss-normalize-positions
Advanced tools
Comparing version
@@ -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 |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
-100%6513
-0.66%95
-2.06%1
Infinity%