4 const _ = require("lodash");
5 const getNextNonSharedLineCommentNode = require("./getNextNonSharedLineCommentNode");
6 const getPreviousNonSharedLineCommentNode = require("./getPreviousNonSharedLineCommentNode");
8 function nodesShareLines(a, b) {
9 return _.get(a, "source.end.line") === _.get(b, "source.start.line");
12 module.exports = function isSharedLineComment(
13 node /*: postcss$node*/
15 if (node.type !== "comment") {
19 const previousNonSharedLineCommentNode = getPreviousNonSharedLineCommentNode(
22 if (nodesShareLines(previousNonSharedLineCommentNode, node)) {
26 const nextNonSharedLineCommentNode = getNextNonSharedLineCommentNode(node);
27 if (nodesShareLines(node, nextNonSharedLineCommentNode)) {
31 const parentNode = node.parent;
33 parentNode !== undefined &&
34 parentNode.type !== "root" &&
35 parentNode.source.start.line === node.source.start.line