Skip to content

Commit 75fc72e

Browse files
committed
Refactor border shorthand generators to use default priority
Updated generateBorderLineShorthand, generateBorderPositionShorthand, and generateBorderNameShorthand to use a default parameter for priority instead of reassigning within the function. This simplifies the function signatures and improves code clarity.
1 parent 1419805 commit 75fc72e

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

lib/normalize.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,17 +1062,16 @@ const prepareBorderProperties = (property, value, priority, properties, opt = {}
10621062
*
10631063
* @param {Map} items - The map of collected property items.
10641064
* @param {string} property - The shorthand property name to generate.
1065-
* @param {string} prior - The priority of the property.
1065+
* @param {string} [priority=""] - The priority of the property.
10661066
* @returns {Array} A key-value pair for the generated property.
10671067
*/
1068-
const generateBorderLineShorthand = (items, property, prior) => {
1068+
const generateBorderLineShorthand = (items, property, priority = "") => {
10691069
const values = [];
10701070
for (const [, item] of items) {
10711071
const { value: itemValue } = item;
10721072
values.push(itemValue);
10731073
}
10741074
const value = getPositionValue(values);
1075-
const priority = prior ? prior : "";
10761075
return [property, createPropertyItem(property, value, priority)];
10771076
};
10781077

@@ -1081,17 +1080,16 @@ const generateBorderLineShorthand = (items, property, prior) => {
10811080
*
10821081
* @param {Map} items - The map of collected property items.
10831082
* @param {string} property - The shorthand property name to generate.
1084-
* @param {string} prior - The priority of the property.
1083+
* @param {string} [priority=""] - The priority of the property.
10851084
* @returns {Array} A key-value pair for the generated property.
10861085
*/
1087-
const generateBorderPositionShorthand = (items, property, prior) => {
1086+
const generateBorderPositionShorthand = (items, property, priority = "") => {
10881087
const values = [];
10891088
for (const [, item] of items) {
10901089
const { value: itemValue } = item;
10911090
values.push(itemValue);
10921091
}
10931092
const value = values.join(" ");
1094-
const priority = prior ? prior : "";
10951093
return [property, createPropertyItem(property, value, priority)];
10961094
};
10971095

@@ -1100,14 +1098,13 @@ const generateBorderPositionShorthand = (items, property, prior) => {
11001098
*
11011099
* @param {Set|Array} items - The collection of property values.
11021100
* @param {string} property - The shorthand property name to generate.
1103-
* @param {string} prior - The priority of the property.
1101+
* @param {string} [priority=""] - The priority of the property.
11041102
* @returns {Array|undefined} A key-value pair for the generated property or undefined.
11051103
*/
1106-
const generateBorderNameShorthand = (items, property, prior) => {
1104+
const generateBorderNameShorthand = (items, property, priority = "") => {
11071105
const values = new Set(items);
11081106
if (values.size === 1) {
11091107
const value = values.keys().next().value;
1110-
const priority = prior ? prior : "";
11111108
return [property, createPropertyItem(property, value, priority)];
11121109
}
11131110
};

0 commit comments

Comments
 (0)