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

Function filePath

ark/fs/fs.ts:94–105  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

92
93/** Fetch the file and directory paths from a path, uri, or `import.meta.url` */
94export const filePath = (path: string): string => {
95 let file: string
96 if (path.includes("://")) {
97 // is a url, e.g. file://, or https://
98 const url = new URL(path)
99 file = url.protocol === "file:" ? fileURLToPath(url) : url.href
100 } else {
101 // is already a typical path
102 file = path
103 }
104 return file
105}
106
107const fileOfCaller = () =>
108 filePath(caller({ methodName: "fileOfCaller", upStackBy: 1 }).file)

Callers 4

runFormatterIfAvailableFunction · 0.90
fileOfCallerFunction · 0.85
dirOfCallerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected