MCPcopy
hub / github.com/prettier/prettier / hasComment

Function hasComment

src/language-js/utilities/comments.js:61–67  ·  view source on GitHub ↗

* @param {Node} node * @param {number | ((comment: Comment) => boolean)} [flags] * @param {(comment: Comment) => boolean} [fn] * @returns {boolean}

(node, flags, fn)

Source from the content-addressed store, hash-verified

59 * @returns {boolean}
60 */
61function hasComment(node, flags, fn) {
62 if (!isNonEmptyArray(node?.comments)) {
63 return false;
64 }
65 const test = getCommentTestFunction(flags, fn);
66 return test ? node.comments.some(test) : true;
67}
68
69/**
70 * @param {Node} node

Callers 15

isLoneShortArgumentFunction · 0.90
hasLeadingOwnLineCommentFunction · 0.90
shouldHugUnionTypeFunction · 0.90
hasNodeIgnoreCommentFunction · 0.90
needsParenthesesFunction · 0.90
printClauseFunction · 0.90
printBinaryishExpressionFunction · 0.90
couldExpandArgFunction · 0.90

Calls 2

isNonEmptyArrayFunction · 0.85
getCommentTestFunctionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…