MCPcopy Index your code
hub / github.com/TypeScriptToLua/TypeScriptToLua / formatPathToLuaPath

Function formatPathToLuaPath

src/utils.ts:41–48  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

39export const trimExtension = (filePath: string) => filePath.slice(0, -path.extname(filePath).length);
40
41export function formatPathToLuaPath(filePath: string): string {
42 filePath = filePath.replace(/\.json$/, "");
43 if (process.platform === "win32") {
44 // Windows can use backslashes
45 filePath = filePath.replace(/\.\\/g, "").replace(/\\/g, ".");
46 }
47 return filePath.replace(/\.\//g, "").replace(/\//g, ".");
48}
49
50type NoInfer<T> = [T][T extends any ? 0 : never];
51

Callers 4

injectLuaFileFunction · 0.90
requirePathForFileFunction · 0.90
fallbackResolveFunction · 0.90
createModulePathFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected