PHP 7.4.33
Preview: columns.js Size: 902 B
/var/www/cvr-leads.bitkit.dk/httpdocs/node_modules/postcss-ordered-values/src/rules/columns.js
'use strict';
const { unit } = require('postcss-value-parser');

/**
 * @param {string} value
 * @return {boolean}
 */
function hasUnit(value) {
  const parsedVal = unit(value);
  return parsedVal && parsedVal.unit !== '';
}

/**
 * @param {import('postcss-value-parser').ParsedValue} columns
 * @return {import('postcss-value-parser').ParsedValue | string}
 */
module.exports = (columns) => {
  /** @type {string[]} */
  const widths = [];
  /** @type {string[]} */
  const other = [];
  columns.walk((node) => {
    const { type, value } = node;
    if (type === 'word') {
      if (hasUnit(value)) {
        widths.push(value);
      } else {
        other.push(value);
      }
    }
  });

  // only transform if declaration is not invalid or a single value
  if (other.length === 1 && widths.length === 1) {
    return `${widths[0].trimStart()} ${other[0].trimStart()}`;
  }

  return columns;
};

Directory Contents

Dirs: 0 × Files: 9
Name Size Perms Modified Actions
3.54 KB lrw-r--r-- 2025-03-11 10:11:50
Edit Download
1.45 KB lrw-r--r-- 2025-03-11 10:11:50
Edit Download
1.77 KB lrw-r--r-- 2025-03-11 10:11:50
Edit Download
902 B lrw-r--r-- 2025-03-11 10:11:49
Edit Download
710 B lrw-r--r-- 2025-03-11 10:11:50
Edit Download
2.92 KB lrw-r--r-- 2025-03-11 10:11:50
Edit Download
1.34 KB lrw-r--r-- 2025-03-11 10:11:50
Edit Download
2.01 KB lrw-r--r-- 2025-03-11 10:11:49
Edit Download
1.92 KB lrw-r--r-- 2025-03-11 10:11:50
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).