MCPcopy Create free account
hub / github.com/microsoft/typescript-go / extensionFromPath

Function extensionFromPath

internal/modulespecifiers/util.go:186–192  ·  view source on GitHub ↗

** * Gets the extension from a path. * Path must have a valid extension. */

(path string)

Source from the content-addressed store, hash-verified

184 * Path must have a valid extension.
185 */
186func extensionFromPath(path string) string {
187 ext := tspath.TryGetExtensionFromPath(path)
188 if len(ext) == 0 {
189 panic(fmt.Sprintf("File %s has unknown extension.", path))
190 }
191 return ext
192}
193
194func tryGetAnyFileFromPath(host ModuleSpecifierGenerationHost, path string) bool {
195 // !!! TODO: shouldn't this use readdir instead of fileexists for perf?

Callers 1

getJSExtensionForFileFunction · 0.85

Calls 3

TryGetExtensionFromPathFunction · 0.92
lenFunction · 0.85
panicFunction · 0.85

Tested by

no test coverage detected