MCPcopy Create free account
hub / github.com/arktypeio/arktype / headOf

Function headOf

ark/aot/unwrite.ts:469–479  ·  view source on GitHub ↗
({ texts }: ModuleTokens)

Source from the content-addressed store, hash-verified

467// what a statement declares, as `export const User`, or what it imports from
468const headOf =
469 ({ texts }: ModuleTokens) =>
470 ([start, end]: StatementTokens): string => {
471 if (texts[start] === "import") {
472 const from = texts[end - 1] === ";" ? end - 2 : end - 1
473 return `import\0${texts[from]}`
474 }
475 let last = start
476 while (last < end && last < start + 6 && !opensValue.test(texts[last]))
477 last++
478 return texts.slice(start, last).join("\0")
479 }
480
481const diffOf = (
482 base: string[],

Callers 1

diffFunction · 0.70

Calls 1

testMethod · 0.80

Tested by

no test coverage detected