remove hafas-client dep

This commit is contained in:
Traines 2024-12-16 12:02:47 +00:00
parent 5bb4e66c9a
commit 30d84352ae
2 changed files with 13 additions and 6 deletions

View file

@ -1,4 +1,12 @@
import {data as c} from 'hafas-client/p/db/loyalty-cards.js'; // TODO remove hafas-client dep? const c = {
NONE: Symbol('no loyalty card'),
BAHNCARD: Symbol('Bahncard'),
VORTEILSCARD: Symbol('VorteilsCard'),
HALBTAXABO: Symbol('HalbtaxAbo'),
VOORDEELURENABO: Symbol('Voordeelurenabo'),
SHCARD: Symbol('SH-Card'),
GENERALABONNEMENT: Symbol('General-Abonnement'),
};
// see https://gist.github.com/juliuste/202bb04f450a79f8fa12a2ec3abcd72d // see https://gist.github.com/juliuste/202bb04f450a79f8fa12a2ec3abcd72d
const formatLoyaltyCard = (data) => { const formatLoyaltyCard = (data) => {
@ -9,26 +17,26 @@ const formatLoyaltyCard = (data) => {
}; };
} }
const cls = data.class === 1 ? 'KLASSE_1' : 'KLASSE_2'; const cls = data.class === 1 ? 'KLASSE_1' : 'KLASSE_2';
if (data.type === c.BAHNCARD) { if (data.type.toString() === c.BAHNCARD.toString()) {
return { return {
art: 'BAHNCARD' + data.discount, art: 'BAHNCARD' + data.discount,
klasse: cls, klasse: cls,
}; };
} }
if (data.type === c.VORTEILSCARD) { if (data.type.toString() === c.VORTEILSCARD.toString()) {
return { return {
art: 'A-VORTEILSCARD', art: 'A-VORTEILSCARD',
klasse: 'KLASSENLOS', klasse: 'KLASSENLOS',
}; };
} }
if (data.type === c.HALBTAXABO) { if (data.type.toString() === c.HALBTAXABO.toString()) {
return { return {
art: 'CH-HALBTAXABO_OHNE_RAILPLUS', art: 'CH-HALBTAXABO_OHNE_RAILPLUS',
klasse: 'KLASSENLOS', klasse: 'KLASSENLOS',
}; };
} }
// TODO Rest // TODO Rest
if (data.type === c.GENERALABONNEMENT) { if (data.type.toString() === c.GENERALABONNEMENT.toString()) {
return { return {
art: 'CH-GENERAL-ABONNEMENT', art: 'CH-GENERAL-ABONNEMENT',
klasse: cls, klasse: cls,

View file

@ -59,7 +59,6 @@
"cross-fetch": "^4.0.0", "cross-fetch": "^4.0.0",
"google-polyline": "^1.0.3", "google-polyline": "^1.0.3",
"gps-distance": "0.0.4", "gps-distance": "0.0.4",
"hafas-client": "^6.3.2",
"https-proxy-agent": "^7.0.0", "https-proxy-agent": "^7.0.0",
"lodash": "^4.17.5", "lodash": "^4.17.5",
"luxon": "^3.1.1", "luxon": "^3.1.1",