mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
PKP: trim "-" from stop names
This commit is contained in:
parent
0dceb414af
commit
916ac3067d
1 changed files with 12 additions and 0 deletions
|
@ -1,5 +1,8 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
|
const {parseHook} = require('../../lib/profile-hooks')
|
||||||
|
|
||||||
|
const parseLocation = require('../../parse/location')
|
||||||
const products = require('./products')
|
const products = require('./products')
|
||||||
|
|
||||||
const transformReqBody = (ctx, body) => {
|
const transformReqBody = (ctx, body) => {
|
||||||
|
@ -10,6 +13,13 @@ const transformReqBody = (ctx, body) => {
|
||||||
return 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 = {
|
const pkpProfile = {
|
||||||
locale: 'pl-PL',
|
locale: 'pl-PL',
|
||||||
timezone: 'Europe/Warsaw',
|
timezone: 'Europe/Warsaw',
|
||||||
|
@ -19,6 +29,8 @@ const pkpProfile = {
|
||||||
|
|
||||||
products,
|
products,
|
||||||
|
|
||||||
|
parseLocation: parseHook(parseLocation, trimStopName),
|
||||||
|
|
||||||
trip: true,
|
trip: true,
|
||||||
radar: true,
|
radar: true,
|
||||||
refreshJourney: false,
|
refreshJourney: false,
|
||||||
|
|
Loading…
Add table
Reference in a new issue