securityos/node_modules/stylelint-order/rules/properties-order/createFlatOrder.js

24 lines
389 B
JavaScript
Raw Permalink Normal View History

2024-09-06 15:32:35 +00:00
const { isString } = require('../../utils/validateType');
module.exports = function createFlatOrder(order) {
const flatOrder = [];
appendGroup(order);
function appendGroup(items) {
items.forEach((item) => appendItem(item));
}
function appendItem(item) {
if (isString(item)) {
flatOrder.push(item);
return;
}
appendGroup(item.properties);
}
return flatOrder;
};