PKP: trim "-" from stop names

This commit is contained in:
Jannis R 2020-03-18 21:43:19 +01:00
parent 0dceb414af
commit 916ac3067d
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5

View file

@ -1,5 +1,8 @@
'use strict'
const {parseHook} = require('../../lib/profile-hooks')
const parseLocation = require('../../parse/location')
const products = require('./products')
const transformReqBody = (ctx, body) => {
@ -10,6 +13,13 @@ const transformReqBody = (ctx, body) => {
return body
}
const trimStopName = ({parsed}, l) => {
if (parsed.type === 'stop' || parsed.type === 'station' && parsed.name) {
parsed.name = parsed.name.replace(/(^-|-$)/g, '')
}
return parsed
}
const pkpProfile = {
locale: 'pl-PL',
timezone: 'Europe/Warsaw',
@ -19,6 +29,8 @@ const pkpProfile = {
products,
parseLocation: parseHook(parseLocation, trimStopName),
trip: true,
radar: true,
refreshJourney: false,