isAfterSingleLineComment.js 488 B

12345678910111213141516171819202122
  1. 'use strict';
  2. const isSharedLineComment = require('./isSharedLineComment');
  3. /**
  4. * @param {import('postcss').Node} node
  5. */
  6. function isAfterSingleLineComment(node) {
  7. const prevNode = node.prev();
  8. return (
  9. prevNode !== undefined &&
  10. prevNode.type === 'comment' &&
  11. !isSharedLineComment(prevNode) &&
  12. prevNode.source &&
  13. prevNode.source.start &&
  14. prevNode.source.end &&
  15. prevNode.source.start.line === prevNode.source.end.line
  16. );
  17. }
  18. module.exports = isAfterSingleLineComment;