db-vendo-client/p/vbb/parse-loc-dhid.js
Kristjan ESPERANTO 66d9fb5194
apply linting rules
follow-up of 228c7253
2024-02-10 16:50:12 +01:00

23 lines
528 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const dhidPrefix = 'A×';
const parseAndAddLocationDHID = (loc, l) => {
if (!Array.isArray(l.gidL)) {
return;
}
const dhidGid = l.gidL.find(gid => gid.slice(0, dhidPrefix.length) === dhidPrefix);
if (!dhidGid) {
return;
}
const dhid = dhidGid.slice(dhidPrefix.length);
// It seems that the DHID of the parent station is being used, not of the stop.
// if (!loc.ids) loc.ids = {}
// loc.ids.dhid = dhid
// todo: use loc.ids.stationDHID instead?
loc.stationDHID = dhid;
};
export {
parseAndAddLocationDHID,
};