MCPcopy Create free account
hub / github.com/TanStack/query / typeAliasBody

Function typeAliasBody

scripts/generate-docs.ts:595–617  ·  view source on GitHub ↗
(source: string | undefined)

Source from the content-addressed store, hash-verified

593}
594
595function typeAliasBody(source: string | undefined) {
596 const declaration = source?.match(/```ts\ntype \w+/)
597 if (!source || !declaration) {
598 return undefined
599 }
600 let index = declaration.index! + declaration[0].length
601 if (source[index] === '<') {
602 let depth = 0
603 for (; index < source.length; index++) {
604 if (source[index] === '<') {
605 depth++
606 } else if (
607 source[index] === '>' &&
608 source[index - 1] !== '=' &&
609 --depth === 0
610 ) {
611 index++
612 break
613 }
614 }
615 }
616 return source.slice(index).match(/^ = ([\s\S]*?);\n```/)?.[1]
617}
618
619function readPage(outputDir: string, from: string) {
620 return readFile(resolve(outputDir, `${from}.md`), 'utf8').then(

Callers 2

basePagesFunction · 0.85
resolveInterfacePagesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected