diff options
author | 2025-07-11 12:32:19 +0200 | |
---|---|---|
committer | 2025-07-11 12:32:19 +0200 | |
commit | 502bfaf9dd6d994af46389e6c297d2c14821ad65 (patch) | |
tree | a71d2c33536f35f4be5c511f4152006efd7ef660 /lib.ts | |
parent | edeb3dfc7a02717b08dbd3118d9b0c932df3fcd8 (diff) | |
download | uic-parse-master.tar.gz uic-parse-master.tar.bz2 uic-parse-master.tar.lz uic-parse-master.zip |
Diffstat (limited to 'lib.ts')
-rw-r--r-- | lib.ts | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -141,11 +141,14 @@ export default class UICVehicle<Operator extends string | null, Country extends public toString() { const cc = this.country?.uicIdentifier ?? this.countryCode; const ccstr = (this.country?.treatyShort ?? UICCountry.countryMaps.byUICIdentificationNumber.get(this.countryCode!)?.treatyShort ?? null) - // 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}` : ''}` + return `${this.vehicleType} ${cc} ${cc === '85' && + // 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 + [ + // 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)}` : + // FIXME: if cc==='85' and this is a DPZ, DPZplus, etc..., it is split in the middle, separated by a dash. + this.vehicleFamily} ${this.serialNumber} ${this.getSelfCheckDigit()}${ccstr && this.operator ? ` ${ccstr}-${this.operator}` : ''}` } public toJSON() { return { |