UNPKG

451 BJavaScriptView Raw
1'use strict';
2
3/** @typedef {import('postcss').Node} PostcssNode */
4
5/**
6 * Get the next non-comment node in a PostCSS AST
7 * at or after a given node.
8 *
9 * @param {PostcssNode | void} startNode
10 * @returns {PostcssNode | null}
11 */
12module.exports = function nextNonCommentNode(startNode) {
13 if (!startNode || !startNode.next) return null;
14
15 if (startNode.type === 'comment') {
16 return nextNonCommentNode(startNode.next());
17 }
18
19 return startNode;
20};