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

Function splitTypeArguments

scripts/generate-docs.ts:248–264  ·  view source on GitHub ↗
(rest: string)

Source from the content-addressed store, hash-verified

246
247// Splits the escaped type arguments (`\\<…\\>`) that follow a type name from the rest of the line.
248function splitTypeArguments(rest: string) {
249 if (!rest.startsWith('\\<')) {
250 return { typeArguments: undefined, after: rest }
251 }
252 let depth = 0
253 for (let index = 0; index < rest.length; index++) {
254 if (rest.startsWith('\\<', index)) {
255 depth++
256 } else if (rest.startsWith('\\>', index) && --depth === 0) {
257 return {
258 typeArguments: rest.slice(2, index),
259 after: rest.slice(index + 2),
260 }
261 }
262 }
263 return { typeArguments: undefined, after: rest }
264}
265
266// The type page a `Parameters`/`Returns` type line refers to when the whole line is that one type
267// (with an optional default value), looking through wrappers that only change how the value is

Callers 1

linkedTypePageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected