Skip to content

Commit

Permalink
Run linter
Browse files Browse the repository at this point in the history
  • Loading branch information
KristjanESPERANTO committed Dec 7, 2023
1 parent f260474 commit 8cd243e
Show file tree
Hide file tree
Showing 169 changed files with 5,616 additions and 5,521 deletions.
8 changes: 4 additions & 4 deletions docs/profile-boilerplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ const products = [
bitmasks: [16],
name: 'ACME Commuter Rail',
short: 'CR',
default: true
default: true,
},
{
id: 'metro',
mode: 'train',
bitmasks: [8],
name: 'Foo Bar Metro',
short: 'M',
default: true
}
default: true,
},
]

const transformReqBody = (body) => {
Expand All @@ -37,7 +37,7 @@ const insaProfile = {
products: products,

trip: false,
radar: false
radar: false,
}

export {
Expand Down
4 changes: 2 additions & 2 deletions format/address.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ const formatAddress = (a) => {
A: '2', // address?
O: a.address,
X: formatCoord(a.longitude),
Y: formatCoord(a.latitude)
Y: formatCoord(a.latitude),
}
if (a.id) data.L = a.id
return {
type: 'A', // address
name: a.address,
lid: formatLocationIdentifier(data)
lid: formatLocationIdentifier(data),
}
}

Expand Down
2 changes: 1 addition & 1 deletion format/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const formatDate = (profile, when) => {

return DateTime.fromMillis(+when, {
locale: profile.locale,
zone: timezone
zone: timezone,
}).toFormat('yyyyMMdd')
}

Expand Down
2 changes: 1 addition & 1 deletion format/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const bike = {type: 'BC', mode: 'INC'}
const accessibility = {
none: {type: 'META', mode: 'INC', meta: 'notBarrierfree'},
partial: {type: 'META', mode: 'INC', meta: 'limitedBarrierfree'},
complete: {type: 'META', mode: 'INC', meta: 'completeBarrierfree'}
complete: {type: 'META', mode: 'INC', meta: 'completeBarrierfree'},
}

export {
Expand Down
2 changes: 1 addition & 1 deletion format/lines-req.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const formatLinesReq = (ctx, query) => {
meth: 'LineMatch',
req: {
input: query,
}
},
}
}

Expand Down
8 changes: 7 additions & 1 deletion format/location-filter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
const formatLocationFilter = (stops, addresses, poi) => {
if (stops && addresses && poi) return 'ALL'
return (stops ? 'S' : '') + (addresses ? 'A' : '') + (poi ? 'P' : '')
return (stops
? 'S'
: '') + (addresses
? 'A'
: '') + (poi
? 'P'
: '')
}

export {
Expand Down
8 changes: 5 additions & 3 deletions format/locations-req.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ const formatLocationsReq = (ctx, query) => {
req: {input: {
loc: {
type: profile.formatLocationFilter(opt.stops, opt.addresses, opt.poi),
name: opt.fuzzy ? query + '?' : query
name: opt.fuzzy
? query + '?'
: query,
},
maxLoc: opt.results,
field: 'S' // todo: what is this?
}}
field: 'S', // todo: what is this?
}},
}
}

Expand Down
8 changes: 4 additions & 4 deletions format/nearby-req.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ const formatNearbyReq = (ctx, location) => {
ring: {
cCrd: {
x: profile.formatCoord(location.longitude),
y: profile.formatCoord(location.latitude)
y: profile.formatCoord(location.latitude),
},
maxDist: opt.distance || -1,
minDist: 0
minDist: 0,
},
locFltrL: [
profile.formatProductsFilter(ctx, opt.products || {}),
],
getPOIs: !!opt.poi,
getStops: !!opt.stops,
maxLoc: opt.results
}
maxLoc: opt.results,
},
}
}

Expand Down
4 changes: 2 additions & 2 deletions format/poi.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const formatPoi = (p) => {
O: p.name,
L: p.id,
X: formatCoord(p.longitude),
Y: formatCoord(p.latitude)
})
Y: formatCoord(p.latitude),
}),
}
}

Expand Down
2 changes: 1 addition & 1 deletion format/products-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const formatProductsFilter = (ctx, filter) => {
return {
type: 'PROD',
mode: 'INC',
value: res + ''
value: res + '',
}
}

Expand Down
4 changes: 2 additions & 2 deletions format/radar-req.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ const formatRadarReq = (ctx, north, west, south, east) => {
perStep: Math.round(opt.duration / Math.max(opt.frames, 1) * 1000),
ageOfReport: true, // todo: what is this?
jnyFltrL: [
profile.formatProductsFilter(ctx, opt.products || {})
profile.formatProductsFilter(ctx, opt.products || {}),
],
// todo: what is this? what about realtime?
// - CALC
// - CALC_REPORT (as seen in the INSA Young app)
trainPosMode: 'CALC',
}
},
}
}

Expand Down
10 changes: 6 additions & 4 deletions format/reachable-from-req.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ const formatReachableFromReq = (ctx, address) => {
meth: 'LocGeoReach',
req: {
loc: profile.formatLocation(profile, address, 'address'),
maxDur: opt.maxDuration === null ? -1 : opt.maxDuration,
maxDur: opt.maxDuration === null
? -1
: opt.maxDuration,
maxChg: opt.maxTransfers,
date: profile.formatDate(profile, opt.when),
time: profile.formatTime(profile, opt.when),
period: 120, // todo: what is this?
jnyFltrL: [
profile.formatProductsFilter(ctx, opt.products || {})
]
}
profile.formatProductsFilter(ctx, opt.products || {}),
],
},
}
}

Expand Down
6 changes: 3 additions & 3 deletions format/rectangle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ const formatRectangle = (profile, north, west, south, east) => {
return {
llCrd: {
x: profile.formatCoord(west),
y: profile.formatCoord(south)
y: profile.formatCoord(south),
},
urCrd: {
x: profile.formatCoord(east),
y: profile.formatCoord(north)
}
y: profile.formatCoord(north),
},
}
}

Expand Down
2 changes: 1 addition & 1 deletion format/refresh-journey-req.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const formatRefreshJourneyReq = (ctx, refreshToken) => {
getIST: true, // todo: make an option
getPasslist: !!opt.stopovers,
getPolyline: !!opt.polylines,
getTariff: !!opt.tickets
getTariff: !!opt.tickets,
}
if (profile.refreshJourneyUseOutReconL) {
req.outReconL = [{ctx: refreshToken}]
Expand Down
14 changes: 9 additions & 5 deletions format/station-board-req.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const formatStationBoardReq = (ctx, station, type) => {
const {profile, opt} = ctx

const jnyFltrL = [
profile.formatProductsFilter(ctx, opt.products || {})
profile.formatProductsFilter(ctx, opt.products || {}),
]
if (opt.line !== null) {
jnyFltrL.push({type: 'LINEID', mode: 'INC', value: opt.line})
Expand All @@ -13,19 +13,23 @@ const formatStationBoardReq = (ctx, station, type) => {
date: profile.formatDate(profile, opt.when),
time: profile.formatTime(profile, opt.when),
stbLoc: station,
dirLoc: opt.direction ? profile.formatStation(opt.direction) : undefined,
dirLoc: opt.direction
? profile.formatStation(opt.direction)
: undefined,
jnyFltrL,
dur: opt.duration
dur: opt.duration,
}
if (opt.results !== null) {
req.maxJny = opt.results === Infinity ? 10000 : opt.results
req.maxJny = opt.results === Infinity
? 10000
: opt.results
}
if (profile.departuresGetPasslist) req.getPasslist = !!opt.stopovers
if (profile.departuresStbFltrEquiv) req.stbFltrEquiv = !opt.includeRelatedStations

return {
meth: 'StationBoard',
req
req,
}
}

Expand Down
4 changes: 2 additions & 2 deletions format/station.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ const formatStation = (id) => {
// todo: name necessary?
lid: formatLocationIdentifier({
A: '1', // station?
L: id
L: id,
// todo: `p` – timestamp of when the ID was obtained
})
}),
}
}

Expand Down
4 changes: 2 additions & 2 deletions format/stop-req.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const formatStopReq = (ctx, stopRef) => {
// todo: there's also `StationDetails`, are there differences?
meth: 'LocDetails',
req: {
locL: [stopRef]
}
locL: [stopRef],
},
}
}

Expand Down
2 changes: 1 addition & 1 deletion format/time.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const formatTime = (profile, when) => {

return DateTime.fromMillis(+when, {
locale: profile.locale,
zone: timezone
zone: timezone,
}).toFormat('HHmmss')
}

Expand Down
4 changes: 2 additions & 2 deletions format/trip-req.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const formatTripReq = ({opt}, id) => {
// HAFAS apparently ignores the date in the trip ID and uses the `date` field.
// Thus, it will find a different trip if you pass the wrong date via `opt.when`.
// date: profile.formatDate(profile, opt.when),
getPolyline: !!opt.polyline
}
getPolyline: !!opt.polyline,
},
}
}

Expand Down
Loading

0 comments on commit 8cd243e

Please sign in to comment.