postcss-normalize-positions 4.0.0-rc.2 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +21 -25
  3. package/package.json +7 -7
package/README.md CHANGED
@@ -35,7 +35,7 @@ examples for your environment.
35
35
 
36
36
  ## Contributors
37
37
 
38
- See [CONTRIBUTORS.md](https://github.com/ben-eb/cssnano/blob/master/CONTRIBUTORS.md).
38
+ See [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).
39
39
 
40
40
  ## License
41
41
 
package/dist/index.js CHANGED
@@ -20,32 +20,32 @@ var _has2 = _interopRequireDefault(_has);
20
20
 
21
21
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
22
 
23
- var directions = ['top', 'right', 'bottom', 'left', 'center'];
23
+ const directions = ['top', 'right', 'bottom', 'left', 'center'];
24
24
 
25
- var center = '50%';
25
+ const center = '50%';
26
26
 
27
- var horizontal = {
27
+ const horizontal = {
28
28
  right: '100%',
29
29
  left: '0'
30
30
  };
31
31
 
32
- var vertical = {
32
+ const vertical = {
33
33
  bottom: '100%',
34
34
  top: '0'
35
35
  };
36
36
 
37
37
  function transform(decl) {
38
- var values = (0, _postcssValueParser2.default)(decl.value);
39
- var args = (0, _cssnanoUtilGetArguments2.default)(values);
40
- var relevant = [];
41
- args.forEach(function (arg) {
38
+ const values = (0, _postcssValueParser2.default)(decl.value);
39
+ const args = (0, _cssnanoUtilGetArguments2.default)(values);
40
+ const relevant = [];
41
+ args.forEach(arg => {
42
42
  relevant.push({
43
43
  start: null,
44
44
  end: null
45
45
  });
46
- arg.forEach(function (part, index) {
47
- var isPosition = ~directions.indexOf(part.value) || (0, _postcssValueParser.unit)(part.value);
48
- var len = relevant.length - 1;
46
+ arg.forEach((part, index) => {
47
+ const isPosition = ~directions.indexOf(part.value) || (0, _postcssValueParser.unit)(part.value);
48
+ const len = relevant.length - 1;
49
49
  if (relevant[len].start === null && isPosition) {
50
50
  relevant[len].start = index;
51
51
  relevant[len].end = index;
@@ -62,11 +62,11 @@ function transform(decl) {
62
62
  }
63
63
  });
64
64
  });
65
- relevant.forEach(function (range, index) {
65
+ relevant.forEach((range, index) => {
66
66
  if (range.start === null) {
67
67
  return;
68
68
  }
69
- var position = args[index].slice(range.start, range.end + 1);
69
+ const position = args[index].slice(range.start, range.end + 1);
70
70
  if (position.length > 3) {
71
71
  return;
72
72
  }
@@ -74,9 +74,8 @@ function transform(decl) {
74
74
  if (position[2]) {
75
75
  position[2].value = position[1].value = '';
76
76
  }
77
- var value = position[0].value;
78
-
79
- var map = Object.assign({}, horizontal, {
77
+ const { value } = position[0];
78
+ const map = Object.assign({}, horizontal, {
80
79
  center
81
80
  });
82
81
  if ((0, _has2.default)(map, value)) {
@@ -86,10 +85,9 @@ function transform(decl) {
86
85
  }
87
86
  if (position[0].value === 'center' && ~directions.indexOf(position[2].value)) {
88
87
  position[0].value = position[1].value = '';
89
- var _value = position[2].value;
90
-
91
- if ((0, _has2.default)(horizontal, _value)) {
92
- position[2].value = horizontal[_value];
88
+ const { value } = position[2];
89
+ if ((0, _has2.default)(horizontal, value)) {
90
+ position[2].value = horizontal[value];
93
91
  }
94
92
  return;
95
93
  }
@@ -98,7 +96,7 @@ function transform(decl) {
98
96
  position[2].value = vertical[position[2].value];
99
97
  return;
100
98
  } else if ((0, _has2.default)(vertical, position[0].value) && (0, _has2.default)(horizontal, position[2].value)) {
101
- var first = position[0].value;
99
+ let first = position[0].value;
102
100
  position[0].value = horizontal[position[2].value];
103
101
  position[2].value = vertical[first];
104
102
  return;
@@ -107,9 +105,7 @@ function transform(decl) {
107
105
  decl.value = values.toString();
108
106
  }
109
107
 
110
- exports.default = (0, _postcss.plugin)('postcss-normalize-positions', function () {
111
- return function (css) {
112
- return css.walkDecls(/^(background(-position)?|(-webkit-)?perspective-origin)$/i, transform);
113
- };
108
+ exports.default = (0, _postcss.plugin)('postcss-normalize-positions', () => {
109
+ return css => css.walkDecls(/^(background(-position)?|(-webkit-)?perspective-origin)$/i, transform);
114
110
  });
115
111
  module.exports = exports['default'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postcss-normalize-positions",
3
- "version": "4.0.0-rc.2",
3
+ "version": "4.0.0",
4
4
  "description": "Normalize keyword values for position into length values.",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -18,25 +18,25 @@
18
18
  "license": "MIT",
19
19
  "devDependencies": {
20
20
  "babel-cli": "^6.0.0",
21
- "cross-env": "^3.0.0"
21
+ "cross-env": "^5.0.0"
22
22
  },
23
- "homepage": "https://github.com/ben-eb/cssnano",
23
+ "homepage": "https://github.com/cssnano/cssnano",
24
24
  "author": {
25
25
  "name": "Ben Briggs",
26
26
  "email": "beneb.info@gmail.com",
27
27
  "url": "http://beneb.info"
28
28
  },
29
- "repository": "ben-eb/cssnano",
29
+ "repository": "cssnano/cssnano",
30
30
  "dependencies": {
31
- "cssnano-util-get-arguments": "^4.0.0-rc.2",
31
+ "cssnano-util-get-arguments": "^4.0.0",
32
32
  "has": "^1.0.0",
33
33
  "postcss": "^6.0.0",
34
34
  "postcss-value-parser": "^3.0.0"
35
35
  },
36
36
  "bugs": {
37
- "url": "https://github.com/ben-eb/cssnano/issues"
37
+ "url": "https://github.com/cssnano/cssnano/issues"
38
38
  },
39
39
  "engines": {
40
- "node": ">=4"
40
+ "node": ">=6.9.0"
41
41
  }
42
42
  }