el-beeswarm
Version:
<div style="display: flex; padding: 1rem; flex-direction: column; align-items: center; justify-content: center; height: 100vh; text-align: center; display: flex;
39 lines (30 loc) • 734 B
JavaScript
;
const _ = require('lodash');
/** @typedef {import('postcss').Node} Node */
/**
* @param {Node | void} node
*/
function getNodeLine(node) {
return _.get(node, 'source.start.line');
}
/**
* @param {Node | void} node
* @returns {Node | void}
*/
module.exports = function getNextNonSharedLineCommentNode(node) {
if (node === undefined) {
return undefined;
}
/** @type {Node | void} */
const nextNode = node.next();
if (_.get(nextNode, 'type') !== 'comment') {
return nextNode;
}
if (
getNodeLine(node) === getNodeLine(nextNode) ||
(nextNode !== undefined && getNodeLine(nextNode) === getNodeLine(nextNode.next()))
) {
return getNextNonSharedLineCommentNode(nextNode);
}
return nextNode;
};