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

Function nameIn

ark/aot/host.ts:202–217  ·  view source on GitHub ↗
(dir: string)

Source from the content-addressed store, hash-verified

200): string | undefined => {
201 if (!isAbsolute(file)) return
202 const nameIn = (dir: string): string | undefined => {
203 if (dir in namesByDir) return namesByDir[dir]
204 let name: unknown
205 try {
206 const manifestPath = join(dir, "package.json")
207 const manifest = readFile(manifestPath)
208 if (manifest !== undefined)
209 name = parsePackageManifest(manifest, manifestPath).name
210 } catch {
211 // one that doesn't parse names nothing
212 }
213 return (namesByDir[dir] =
214 typeof name === "string" ? name
215 : dir === dirname(dir) ? undefined
216 : nameIn(dirname(dir)))
217 }
218 return nameIn(dirname(file))
219}
220

Callers 1

workspacePackageNameOfFunction · 0.85

Calls 3

parsePackageManifestFunction · 0.90
joinFunction · 0.85
readFileFunction · 0.70

Tested by

no test coverage detected