postcss-ordered-values
Advanced tools
Comparing version
@@ -90,3 +90,3 @@ "use strict"; | ||
parsed.walk(node => { | ||
if (node.type === 'comment' || isVariableFunctionNode(node) || node.type === 'word' && ~node.value.indexOf(`___CSS_LOADER_IMPORT___`)) { | ||
if (node.type === 'comment' || isVariableFunctionNode(node) || node.type === 'word' && node.value.includes(`___CSS_LOADER_IMPORT___`)) { | ||
abort = true; | ||
@@ -93,0 +93,0 @@ return false; |
@@ -7,5 +7,7 @@ "use strict"; | ||
exports.default = void 0; | ||
// All of the curently implemented math functions | ||
var _default = ['calc', 'clamp', 'max', 'min']; | ||
var _default = new Set(['calc', 'clamp', 'max', 'min']); | ||
exports.default = _default; | ||
module.exports = exports.default; |
@@ -16,5 +16,5 @@ "use strict"; | ||
// outline: <outline-color> || <outline-style> || <outline-width> | ||
const borderWidths = ['thin', 'medium', 'thick']; | ||
const borderStyles = ['none', 'auto', // only in outline-style | ||
'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset']; | ||
const borderWidths = new Set(['thin', 'medium', 'thick']); | ||
const borderStyles = new Set(['none', 'auto', // only in outline-style | ||
'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset']); | ||
@@ -34,3 +34,3 @@ function normalizeBorder(border) { | ||
if (type === 'word') { | ||
if (borderStyles.includes(value.toLowerCase())) { | ||
if (borderStyles.has(value.toLowerCase())) { | ||
order.style = value; | ||
@@ -40,3 +40,3 @@ return false; | ||
if (borderWidths.includes(value.toLowerCase()) || (0, _postcssValueParser.unit)(value.toLowerCase())) { | ||
if (borderWidths.has(value.toLowerCase()) || (0, _postcssValueParser.unit)(value.toLowerCase())) { | ||
if (order.width !== '') { | ||
@@ -56,3 +56,3 @@ order.width = `${order.width} ${value}`; | ||
if (type === 'function') { | ||
if (_mathfunctions.default.includes(value.toLowerCase())) { | ||
if (_mathfunctions.default.has(value.toLowerCase())) { | ||
order.width = (0, _postcssValueParser.stringify)(node); | ||
@@ -59,0 +59,0 @@ } else { |
@@ -38,3 +38,3 @@ "use strict"; | ||
if (type === 'function' && _mathfunctions.default.includes((0, _vendorUnprefixed.default)(value.toLowerCase()))) { | ||
if (type === 'function' && _mathfunctions.default.has((0, _vendorUnprefixed.default)(value.toLowerCase()))) { | ||
abort = true; | ||
@@ -41,0 +41,0 @@ return; |
@@ -8,4 +8,4 @@ "use strict"; | ||
// flex-flow: <flex-direction> || <flex-wrap> | ||
const flexDirection = ['row', 'row-reverse', 'column', 'column-reverse']; | ||
const flexWrap = ['nowrap', 'wrap', 'wrap-reverse']; | ||
const flexDirection = new Set(['row', 'row-reverse', 'column', 'column-reverse']); | ||
const flexWrap = new Set(['nowrap', 'wrap', 'wrap-reverse']); | ||
@@ -20,3 +20,3 @@ function normalizeFlexFlow(flexFlow) { | ||
}) => { | ||
if (~flexDirection.indexOf(value.toLowerCase())) { | ||
if (flexDirection.has(value.toLowerCase())) { | ||
order.direction = value; | ||
@@ -26,3 +26,3 @@ return; | ||
if (~flexWrap.indexOf(value.toLowerCase())) { | ||
if (flexWrap.has(value.toLowerCase())) { | ||
order.wrap = value; | ||
@@ -29,0 +29,0 @@ return; |
@@ -14,4 +14,4 @@ "use strict"; | ||
const definedTypes = _listStyleTypes.default['list-style-type']; | ||
const definedPosition = ['inside', 'outside']; | ||
const definedTypes = new Set(_listStyleTypes.default['list-style-type']); | ||
const definedPosition = new Set(['inside', 'outside']); | ||
@@ -26,6 +26,6 @@ function listStyleNormalizer(listStyle) { | ||
if (decl.type === 'word') { | ||
if (definedTypes.includes(decl.value)) { | ||
if (definedTypes.has(decl.value)) { | ||
// its a type field | ||
order.type = `${order.type} ${decl.value}`; | ||
} else if (definedPosition.includes(decl.value)) { | ||
} else if (definedPosition.has(decl.value)) { | ||
order.position = `${order.position} ${decl.value}`; | ||
@@ -32,0 +32,0 @@ } else if (decl.value === 'none') { |
@@ -19,3 +19,3 @@ "use strict"; | ||
// transition: [ none | <single-transition-property> ] || <time> || <single-transition-timing-function> || <time> | ||
const timingFunctions = ['ease', 'linear', 'ease-in', 'ease-out', 'ease-in-out', 'step-start', 'step-end']; | ||
const timingFunctions = new Set(['ease', 'linear', 'ease-in', 'ease-out', 'ease-in-out', 'step-start', 'step-end']); | ||
@@ -41,3 +41,3 @@ function normalizeTransition(parsed) { | ||
if (type === 'function' && ~['steps', 'cubic-bezier'].indexOf(value.toLowerCase())) { | ||
if (type === 'function' && new Set(['steps', 'cubic-bezier']).has(value.toLowerCase())) { | ||
state.timingFunction = [...state.timingFunction, node, (0, _addSpace.default)()]; | ||
@@ -50,3 +50,3 @@ } else if ((0, _postcssValueParser.unit)(value)) { | ||
} | ||
} else if (~timingFunctions.indexOf(value.toLowerCase())) { | ||
} else if (timingFunctions.has(value.toLowerCase())) { | ||
state.timingFunction = [...state.timingFunction, node, (0, _addSpace.default)()]; | ||
@@ -53,0 +53,0 @@ } else { |
{ | ||
"name": "postcss-ordered-values", | ||
"version": "5.0.3", | ||
"version": "5.0.4", | ||
"description": "Ensure values are ordered consistently in your CSS.", | ||
@@ -24,3 +24,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"cssnano-utils": "^3.0.0", | ||
"cssnano-utils": "^3.0.1", | ||
"postcss-value-parser": "^4.2.0" | ||
@@ -27,0 +27,0 @@ }, |
27616
0.12%Updated