MCPcopy Index your code
hub / github.com/Ransomwave/azul / classifyScriptFileName

Function classifyScriptFileName

src/util/scriptFile.ts:39–76  ·  view source on GitHub ↗
(
  fileName: string,
  options: ClassifyScriptFileOptions = {},
)

Source from the content-addressed store, hash-verified

37}
38
39export function classifyScriptFileName(
40 fileName: string,
41 options: ClassifyScriptFileOptions = {},
42): ClassifiedScriptFile {
43 const normalized = normalizeLuaLikeFileName(fileName);
44 const base = normalized.replace(/\.luau$/i, "");
45
46 const normalizeName = (name: string) =>
47 options.stripDisambiguationSuffix
48 ? stripScriptDisambiguationSuffix(name)
49 : name;
50
51 if (base.endsWith(".server")) {
52 return {
53 className: "Script",
54 scriptName: normalizeName(base.replace(/\.server$/, "")),
55 };
56 }
57
58 if (base.endsWith(".client")) {
59 return {
60 className: "LocalScript",
61 scriptName: normalizeName(base.replace(/\.client$/, "")),
62 };
63 }
64
65 if (base.endsWith(".module")) {
66 return {
67 className: "ModuleScript",
68 scriptName: normalizeName(base.replace(/\.module$/, "")),
69 };
70 }
71
72 return {
73 className: "ModuleScript",
74 scriptName: normalizeName(base),
75 };
76}

Callers 7

walkMethod · 0.85
walkMethod · 0.85
buildMethod · 0.85
parseModelNodeMethod · 0.85
emitNodeMethod · 0.85
walkDirectoryMethod · 0.85

Calls 2

normalizeLuaLikeFileNameFunction · 0.85
normalizeNameFunction · 0.85

Tested by

no test coverage detected