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

Function printNamespace

packages/tools/docgen/src/Printer.ts:243–267  ·  view source on GitHub ↗
(
  model: Domain.Namespace,
  indentation: number
)

Source from the content-addressed store, hash-verified

241}
242
243const printNamespace = (
244 model: Domain.Namespace,
245 indentation: number
246): Effect.Effect<string, never, Configuration.Configuration | Parser.Source> => {
247 return Effect.gen(function*() {
248 const header = yield* printModel(model.name, model.doc, {
249 position: model.position,
250 indentation,
251 postfix: "(namespace)"
252 })
253 const interfaces = yield* Effect.forEach(model.interfaces, (inter) => printInterface(inter, indentation + 1))
254 const typeAliases = yield* Effect.forEach(
255 model.typeAliases,
256 (typeAlias) => printTypeAlias(typeAlias, indentation + 1)
257 )
258 const namespaces = yield* Effect.forEach(
259 model.namespaces,
260 (namespace) => printNamespace(namespace, indentation + 1)
261 )
262 return header +
263 interfaces.map((s) => "\n\n" + s).join("") +
264 typeAliases.map((s) => "\n\n" + s).join("") +
265 namespaces.map((s) => "\n\n" + s).join("")
266 })
267}
268
269/** @internal */
270export const print = (p: Printable) => {

Callers 1

printFunction · 0.85

Calls 6

printModelFunction · 0.85
printInterfaceFunction · 0.85
printTypeAliasFunction · 0.85
joinMethod · 0.80
forEachMethod · 0.65
mapMethod · 0.45

Tested by

no test coverage detected