( source: string, node: AstNode, ignoredRange?: [number, number] )
| 889 | * @since 4.0.0 |
| 890 | */ |
| 891 | export function findLeadingJSDoc( |
| 892 | source: string, |
| 893 | node: AstNode, |
| 894 | ignoredRange?: [number, number] |
| 895 | ): JSDocBlock | undefined { |
| 896 | const end = skipDirectiveComments(source, skipWhitespace(source, node.range[0])) |
| 897 | if (!source.slice(0, end).endsWith("*/")) { |
| 898 | return undefined |
| 899 | } |
| 900 | |
| 901 | const start = source.lastIndexOf("/*", end) |
| 902 | if (start === -1 || source[start + 2] !== "*") { |
| 903 | return undefined |
| 904 | } |
| 905 | const range: [number, number] = [start, end] |
| 906 | if (ignoredRange !== undefined && range[0] === ignoredRange[0] && range[1] === ignoredRange[1]) { |
| 907 | return undefined |
| 908 | } |
| 909 | return parseJSDocBlock(source.slice(start, end), range) |
| 910 | } |
| 911 | |
| 912 | /** |
| 913 | * Parses one raw JSDoc block into the standard description, example, and tag structure. |
nothing calls this directly
no test coverage detected