2022-05-07 16:17:37 +02:00
|
|
|
import flatMap from 'lodash/flatMap.js'
|
2019-08-23 16:21:44 +02:00
|
|
|
|
2018-06-07 16:00:28 +02:00
|
|
|
// There are two kinds of notes: "remarks" (in `remL`) and HAFAS
|
|
|
|
// Information Manager (HIM) notes (in `himL`). The former describe
|
|
|
|
// the regular operating situation, e.g. "bicycles allows", whereas
|
|
|
|
// the latter describe cancellations, construction work, etc.
|
|
|
|
|
|
|
|
// hafas-client's naming scheme:
|
|
|
|
// - hints: notes from `remL` for regular operation
|
|
|
|
// - warnings: notes from `himL` for cancellations, construction, etc
|
|
|
|
// - remarks: both "notes" and "warnings"
|
|
|
|
|
2019-08-23 16:21:44 +02:00
|
|
|
const findRemarks = (refs) => {
|
|
|
|
return flatMap(refs, (ref) => {
|
|
|
|
return [ref.warning, ref.hint]
|
|
|
|
.filter(rem => !!rem)
|
|
|
|
.map(rem => [rem, ref])
|
|
|
|
})
|
2018-06-07 16:00:28 +02:00
|
|
|
}
|
|
|
|
|
2022-05-07 16:17:37 +02:00
|
|
|
export {
|
|
|
|
findRemarks,
|
|
|
|
}
|