jrshikoku/lib/getStringConfig.ts
2025-08-08 09:25:40 +00:00

61 lines
1.6 KiB
TypeScript

type typeID =
| "Normal"
| "OneMan"
| "Rapid"
| "OneManRapid"
| "LTDEXP"
| "NightLTDEXP"
| "SPCL"
| "SPCL_Normal"
| "SPCL_Rapid"
| "SPCL_EXP"
| "Freight"
| "Forwarding"
| "FreightForwarding"
| "Other";
type types = (types: typeID, id: string) => [string, boolean, boolean];
export const getStringConfig: types = (type, id) => {
switch (type) {
case "Normal":
return ["普通", true, false];
case "OneMan":
return ["普通", true, true];
case "Rapid":
return ["快速", true, false];
case "OneManRapid":
return ["快速", true, true];
case "LTDEXP":
return ["特急", true, false];
case "NightLTDEXP":
return ["特急", true, false];
case "SPCL":
return ["臨時", true, false];
case "SPCL_Normal":
return ["臨時", true, false];
case "SPCL_Rapid":
return ["臨時快速", true, false];
case "SPCL_EXP":
return ["臨時特急", true, false];
case "Freight":
return ["貨物", false, false];
case "Forwarding":
return ["回送", false, false];
case "FreightForwarding":
return ["単機回送", false, false];
case "Other":
switch (true) {
case !!id.includes("T"):
return ["単機回送", false, false];
case !!id.includes("R"):
case !!id.includes("E"):
case !!id.includes("L"):
case !!id.includes("A"):
case !!id.includes("B"):
return ["回送", false, false];
case !!id.includes("H"):
return ["試運転", false, false];
}
return ["", false, false];
}
};