aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib.ts b/lib.ts
index e05e937..a573fa6 100644
--- a/lib.ts
+++ b/lib.ts
@@ -139,10 +139,13 @@ export default class UICVehicle<Operator extends string | null, Country extends
return UICVehicle.getSelfCheckDigit(this.vehicleType + (this.country?.uicIdentifier ?? this.countryCode) + this.vehicleFamily + this.serialNumber).toString() as Digit
}
public toString() {
- // Separation of first character of vehicleFamily is typically done in Switzerland for SBB and BLS (although not Thurbo?) - and not in germany, unsure about elsewhere
const cc = this.country?.uicIdentifier ?? this.countryCode;
const ccstr = (this.country?.treatyShort ?? UICCountry.countryMaps.byUICIdentificationNumber.get(this.countryCode!)?.treatyShort ?? null)
- return `${this.vehicleType} ${cc} ${cc === '85' ? `${this.vehicleFamily.charAt(1) + ' ' + this.vehicleFamily.substring(1)}` : this.vehicleFamily} ${this.serialNumber} ${this.getSelfCheckDigit()}${ccstr && this.operator ? ` ${ccstr}-${this.operator}` : ''}`
+ // Separation of first character of vehicleFamily for is typically done in Switzerland for SBB and BLS (although not Thurbo?) for their EMUs (first digit often signifying wagon, 0 for entire vehicle) - and not in germany, unsure about elsewhere
+ return `${this.vehicleType} ${cc} ${cc === '85' && [
+ // TODO: figure out if 5 is a reserved prefix (if so, where is it specified) for EMUs
+ '500', '501', '502', '503', '510', '511', '512', '514', '515', '520', '521', '522', '523', '524', '525', '526', '528', '535', '565', '566'
+ ].includes(this.vehicleFamily.substring(1)) ? `${this.vehicleFamily.charAt(1) + ' ' + this.vehicleFamily.substring(1)}` : this.vehicleFamily} ${this.serialNumber} ${this.getSelfCheckDigit()}${ccstr && this.operator ? ` ${ccstr}-${this.operator}` : ''}`
}
public toJSON() {
return {