UNPKG

@typespec/http-server-js

Version:

TypeSpec HTTP server code generator for JavaScript

21 lines 656 B
// Copyright (c) Microsoft Corporation // Licensed under the MIT license. import { getDoc } from "@typespec/compiler"; import { indent } from "../util/iter.js"; /** * Emit the documentation for a type in JSDoc format. * * This assumes that the documentation may include Markdown formatting. * * @param ctx - The emitter context. * @param type - The type to emit documentation for. */ export function* emitDocumentation(ctx, type) { const doc = getDoc(ctx.program, type); if (doc === undefined) return; yield `/**`; yield* indent(doc.trim().split(/\r?\n/g), " * "); yield ` */`; } //# sourceMappingURL=documentation.js.map