MCPcopy Create free account
hub / github.com/Effect-TS/effect / findLeadingJSDoc

Function findLeadingJSDoc

packages/tools/jsdocs/src/Jsdocs.ts:891–910  ·  view source on GitHub ↗
(
  source: string,
  node: AstNode,
  ignoredRange?: [number, number]
)

Source from the content-addressed store, hash-verified

889 * @since 4.0.0
890 */
891export 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.

Callers

nothing calls this directly

Calls 3

skipDirectiveCommentsFunction · 0.85
skipWhitespaceFunction · 0.85
parseJSDocBlockFunction · 0.85

Tested by

no test coverage detected