(flags, fn)
| 31 | }; |
| 32 | |
| 33 | const getCommentTestFunction = (flags, fn) => { |
| 34 | if (typeof flags === "function") { |
| 35 | fn = flags; |
| 36 | flags = 0; |
| 37 | } |
| 38 | if (flags || fn) { |
| 39 | return (comment, index, comments) => |
| 40 | !( |
| 41 | (flags & CommentCheckFlags.Leading && !comment.leading) || |
| 42 | (flags & CommentCheckFlags.Trailing && !comment.trailing) || |
| 43 | (flags & CommentCheckFlags.Dangling && |
| 44 | (comment.leading || comment.trailing)) || |
| 45 | (flags & CommentCheckFlags.Block && !isBlockComment(comment)) || |
| 46 | (flags & CommentCheckFlags.Line && !isLineComment(comment)) || |
| 47 | (flags & CommentCheckFlags.First && index !== 0) || |
| 48 | (flags & CommentCheckFlags.Last && index !== comments.length - 1) || |
| 49 | (flags & CommentCheckFlags.PrettierIgnore && |
| 50 | !isPrettierIgnoreComment(comment)) || |
| 51 | (fn && !fn(comment)) |
| 52 | ); |
| 53 | } |
| 54 | }; |
| 55 | /** |
| 56 | * @param {Node} node |
| 57 | * @param {number | ((comment: Comment) => boolean)} [flags] |
no test coverage detected
searching dependent graphs…