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

Function parseComment

packages/tools/docgen/src/Parser.ts:63–89  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

61 * @internal
62 */
63export const parseComment = (text: string): Comment => {
64 const annotation: doctrine.Annotation = doctrine.parse(text, {
65 unwrap: true
66 })
67
68 const description = pipe(
69 Option.fromNullishOr(annotation.description),
70 Option.map((s) => s.trim()),
71 Option.filter(String.isNonEmpty),
72 Option.getOrUndefined
73 )
74
75 const tags = pipe(
76 annotation.tags,
77 Array.groupBy((tag) => tag.title),
78 Record.map((values) =>
79 Array.map(values, (tag) =>
80 pipe(
81 Option.fromNullishOr(tag.description),
82 Option.map(String.trim),
83 Option.getOrElse(() => "")
84 ))
85 )
86 )
87
88 return { description, tags }
89}
90
91const isVariableDeclarationList = (
92 u: ast.VariableDeclarationList | ast.CatchClause

Callers 1

parseDocFunction · 0.85

Calls 4

filterMethod · 0.80
pipeFunction · 0.50
parseMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected