securityos/node_modules/stylelint/lib/utils/removeEmptyLinesBefore.js

16 lines
364 B
JavaScript
Raw Normal View History

2024-09-06 15:32:35 +00:00
'use strict';
/**
* Remove empty lines before a node. Mutates the node.
*
* @template {import('postcss').Node} T
* @param {T} node
* @param {string} newline
* @returns {T}
*/
module.exports = function removeEmptyLinesBefore(node, newline) {
node.raws.before = node.raws.before ? node.raws.before.replace(/(\r?\n\s*\n)+/g, newline) : '';
return node;
};