mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
merge remarks into next
This commit is contained in:
commit
0db84ce644
19 changed files with 310 additions and 44 deletions
8
index.js
8
index.js
|
@ -51,7 +51,7 @@ const createClient = (profile, request = _request) => {
|
|||
})
|
||||
.then((d) => {
|
||||
if (!Array.isArray(d.jnyL)) return [] // todo: throw err?
|
||||
const parse = profile.parseDeparture(profile, d.locations, d.lines, d.remarks)
|
||||
const parse = profile.parseDeparture(profile, d.locations, d.lines, d.hints, d.warnings)
|
||||
return d.jnyL.map(parse)
|
||||
.sort((a, b) => new Date(a.when) - new Date(b.when))
|
||||
})
|
||||
|
@ -164,7 +164,7 @@ const createClient = (profile, request = _request) => {
|
|||
if (!Array.isArray(d.outConL)) return []
|
||||
|
||||
const polylines = opt.polylines && d.common.polyL || []
|
||||
const parse = profile.parseJourney(profile, d.locations, d.lines, d.remarks, polylines)
|
||||
const parse = profile.parseJourney(profile, d.locations, d.lines, d.hints, d.warnings, polylines)
|
||||
|
||||
if (!journeys.earlierRef) journeys.earlierRef = d.outCtxScrB
|
||||
|
||||
|
@ -310,7 +310,7 @@ const createClient = (profile, request = _request) => {
|
|||
})
|
||||
.then((d) => {
|
||||
const polylines = opt.polyline && d.common.polyL || []
|
||||
const parse = profile.parseJourneyLeg(profile, d.locations, d.lines, d.remarks, polylines)
|
||||
const parse = profile.parseJourneyLeg(profile, d.locations, d.lines, d.hints, d.warnings, polylines)
|
||||
|
||||
const leg = { // pretend the leg is contained in a journey
|
||||
type: 'JNY',
|
||||
|
@ -364,7 +364,7 @@ const createClient = (profile, request = _request) => {
|
|||
if (!Array.isArray(d.jnyL)) return []
|
||||
|
||||
const polylines = opt.polyline && d.common.polyL || []
|
||||
const parse = profile.parseMovement(profile, d.locations, d.lines, d.remarks, polylines)
|
||||
const parse = profile.parseMovement(profile, d.locations, d.lines, d.hints, d.warnings, polylines)
|
||||
return d.jnyL.map(parse)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@ const parsePolyline = require('../parse/polyline')
|
|||
const parseMovement = require('../parse/movement')
|
||||
const parseNearby = require('../parse/nearby')
|
||||
const parseOperator = require('../parse/operator')
|
||||
const parseRemark = require('../parse/remark')
|
||||
const parseHint = require('../parse/hint')
|
||||
const parseWarning = require('../parse/warning')
|
||||
const parseStopover = require('../parse/stopover')
|
||||
|
||||
const formatAddress = require('../format/address')
|
||||
|
@ -47,7 +48,8 @@ const defaultProfile = {
|
|||
parseMovement,
|
||||
parseNearby,
|
||||
parseOperator,
|
||||
parseRemark,
|
||||
parseHint,
|
||||
parseWarning,
|
||||
parseStopover,
|
||||
|
||||
formatAddress,
|
||||
|
|
|
@ -82,7 +82,11 @@ const request = (profile, data) => {
|
|||
const c = d.common || {}
|
||||
|
||||
if (Array.isArray(c.remL)) {
|
||||
d.remarks = c.remL.map(rem => profile.parseRemark(profile, rem))
|
||||
d.hints = c.remL.map(hint => profile.parseHint(profile, hint))
|
||||
}
|
||||
d.warnings = []
|
||||
if (Array.isArray(c.himL)) {
|
||||
d.warnings = c.himL.map(w => profile.parseWarning(profile, w))
|
||||
}
|
||||
if (Array.isArray(c.opL)) {
|
||||
d.operators = c.opL.map(op => profile.parseOperator(profile, op))
|
||||
|
|
|
@ -20,7 +20,8 @@ const types = {
|
|||
parseMovement: 'function',
|
||||
parseNearby: 'function',
|
||||
parseOperator: 'function',
|
||||
parseRemark: 'function',
|
||||
parseHint: 'function',
|
||||
parseWarning: 'function',
|
||||
parseStopover: 'function',
|
||||
|
||||
formatAddress: 'function',
|
||||
|
|
|
@ -34,8 +34,8 @@ const transformJourneysQuery = (query, opt) => {
|
|||
return query
|
||||
}
|
||||
|
||||
const createParseJourney = (profile, stations, lines, remarks, polylines) => {
|
||||
const parseJourney = _createParseJourney(profile, stations, lines, remarks, polylines)
|
||||
const createParseJourney = (profile, stations, lines, hints, polylines) => {
|
||||
const parseJourney = _createParseJourney(profile, stations, lines, hints, polylines)
|
||||
|
||||
// todo: j.sotRating, j.conSubscr, j.isSotCon, j.showARSLink, k.sotCtxt
|
||||
// todo: j.conSubscr, j.showARSLink, j.useableTime
|
||||
|
|
|
@ -36,8 +36,8 @@ const parseLocation = (profile, l, lines) => {
|
|||
return res
|
||||
}
|
||||
|
||||
const createParseJourney = (profile, stations, lines, remarks) => {
|
||||
const parseJourney = _createParseJourney(profile, stations, lines, remarks)
|
||||
const createParseJourney = (profile, stations, lines, hints) => {
|
||||
const parseJourney = _createParseJourney(profile, stations, lines, hints)
|
||||
|
||||
const parseJourneyWithTickets = (j) => {
|
||||
const res = parseJourney(j)
|
||||
|
@ -78,8 +78,8 @@ const createParseJourney = (profile, stations, lines, remarks) => {
|
|||
return parseJourneyWithTickets
|
||||
}
|
||||
|
||||
const createParseMovement = (profile, locations, lines, remarks) => {
|
||||
const _parseMovement = _createParseMovement(profile, locations, lines, remarks)
|
||||
const createParseMovement = (profile, locations, lines, hints) => {
|
||||
const _parseMovement = _createParseMovement(profile, locations, lines, hints)
|
||||
const parseMovement = (m) => {
|
||||
const res = _parseMovement(m)
|
||||
// filter out empty nextStops entries
|
||||
|
|
|
@ -44,8 +44,8 @@ const parseLocation = (profile, l, lines) => {
|
|||
return res
|
||||
}
|
||||
|
||||
const createParseMovement = (profile, locations, lines, remarks) => {
|
||||
const _parseMovement = _createParseMovement(profile, locations, lines, remarks)
|
||||
const createParseMovement = (profile, locations, lines, hints) => {
|
||||
const _parseMovement = _createParseMovement(profile, locations, lines, hints)
|
||||
const parseMovement = (m) => {
|
||||
const res = _parseMovement(m)
|
||||
// filter out POIs
|
||||
|
|
|
@ -56,8 +56,8 @@ const parseLocation = (profile, l, lines) => {
|
|||
return res
|
||||
}
|
||||
|
||||
const createParseJourney = (profile, stations, lines, remarks, polylines) => {
|
||||
const parseJourney = _createParseJourney(profile, stations, lines, remarks, polylines)
|
||||
const createParseJourney = (profile, stations, lines, hints, polylines) => {
|
||||
const parseJourney = _createParseJourney(profile, stations, lines, hints, polylines)
|
||||
|
||||
const parseJourneyWithTickets = (j) => {
|
||||
const res = parseJourney(j)
|
||||
|
@ -86,8 +86,8 @@ const createParseJourney = (profile, stations, lines, remarks, polylines) => {
|
|||
return parseJourneyWithTickets
|
||||
}
|
||||
|
||||
const createParseDeparture = (profile, stations, lines, remarks) => {
|
||||
const parseDeparture = _createParseDeparture(profile, stations, lines, remarks)
|
||||
const createParseDeparture = (profile, stations, lines, hints) => {
|
||||
const parseDeparture = _createParseDeparture(profile, stations, lines, hints)
|
||||
|
||||
const ringbahnClockwise = /^ringbahn s\s?41$/i
|
||||
const ringbahnAnticlockwise = /^ringbahn s\s?42$/i
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@mapbox/polyline": "^1.0.0",
|
||||
"br2nl": "^1.0.0",
|
||||
"capture-stack-trace": "^1.0.0",
|
||||
"create-hash": "^1.2.0",
|
||||
"fetch-ponyfill": "^6.0.0",
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
'use strict'
|
||||
|
||||
const findRemark = require('./find-remark')
|
||||
|
||||
// todos from public-transport/hafas-client#2
|
||||
// - stdStop.dPlatfS, stdStop.dPlatfR
|
||||
// todo: what is d.jny.dirFlg?
|
||||
// todo: d.stbStop.dProgType
|
||||
// todo: d.freq, d.freq.jnyL, see https://github.com/public-transport/hafas-client/blob/9203ed1481f08baacca41ac5e3c19bf022f01b0b/parse.js#L115
|
||||
|
||||
const createParseDeparture = (profile, stations, lines, remarks) => {
|
||||
const findRemark = rm => remarks[parseInt(rm.remX)] || null
|
||||
|
||||
const createParseDeparture = (profile, stations, lines, hints, warnings) => {
|
||||
const parseDeparture = (d) => {
|
||||
const when = profile.parseDateTime(profile, d.date, d.stbStop.dTimeR || d.stbStop.dTimeS)
|
||||
const res = {
|
||||
|
@ -17,7 +17,10 @@ const createParseDeparture = (profile, stations, lines, remarks) => {
|
|||
when: when.toISO(),
|
||||
direction: profile.parseStationName(d.dirTxt),
|
||||
line: lines[parseInt(d.prodX)] || null,
|
||||
remarks: d.remL ? d.remL.map(findRemark) : [],
|
||||
remarks: (d.remL
|
||||
? d.remL.map(ref => findRemark(hints, warnings, ref))
|
||||
: []
|
||||
),
|
||||
trip: +d.jid.split('|')[1] // todo: this seems brittle
|
||||
}
|
||||
// todo: res.trip from rawLine.prodCtx.num?
|
||||
|
|
17
parse/find-remark.js
Normal file
17
parse/find-remark.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
'use strict'
|
||||
|
||||
// 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"
|
||||
|
||||
const findRemark = (hints, warnings, ref) => {
|
||||
return warnings[ref.himX] || hints[ref.remX] || null
|
||||
}
|
||||
|
||||
module.exports = findRemark
|
161
parse/hint.js
Normal file
161
parse/hint.js
Normal file
|
@ -0,0 +1,161 @@
|
|||
'use strict'
|
||||
|
||||
const hints = Object.assign(Object.create(null), {
|
||||
fb: {
|
||||
type: 'hint',
|
||||
code: 'bicycle-conveyance',
|
||||
text: 'bicycles conveyed'
|
||||
},
|
||||
nf: {
|
||||
type: 'hint',
|
||||
code: 'no-bicycle-conveyance',
|
||||
text: 'bicycles not conveyed'
|
||||
},
|
||||
k2: {
|
||||
type: 'hint',
|
||||
code: '2nd-class-only',
|
||||
text: '2. class only'
|
||||
},
|
||||
eh: {
|
||||
type: 'hint',
|
||||
code: 'boarding-ramp',
|
||||
text: 'vehicle-mounted boarding ramp available'
|
||||
},
|
||||
wv: {
|
||||
type: 'hint',
|
||||
code: 'wifi',
|
||||
text: 'WiFi available'
|
||||
},
|
||||
sn: {
|
||||
type: 'hint',
|
||||
code: 'snacks',
|
||||
text: 'snacks available for purchase'
|
||||
},
|
||||
bf: {
|
||||
type: 'hint',
|
||||
code: 'barrier-free',
|
||||
text: 'barrier-free'
|
||||
},
|
||||
rg: {
|
||||
type: 'hint',
|
||||
code: 'barrier-free-vehicle',
|
||||
text: 'barrier-free vehicle'
|
||||
},
|
||||
bt: {
|
||||
type: 'hint',
|
||||
code: 'on-board-bistro',
|
||||
text: 'Bordbistro available'
|
||||
},
|
||||
br: {
|
||||
type: 'hint',
|
||||
code: 'on-board-restaurant',
|
||||
text: 'Bordrestaurant available'
|
||||
},
|
||||
ki: {
|
||||
type: 'hint',
|
||||
code: 'childrens-area',
|
||||
text: `children's area available`
|
||||
},
|
||||
ls: {
|
||||
type: 'hint',
|
||||
code: 'power-sockets',
|
||||
text: 'power sockets available'
|
||||
},
|
||||
ev: {
|
||||
type: 'hint',
|
||||
code: 'replacement-service',
|
||||
text: 'replacement service'
|
||||
},
|
||||
kl: {
|
||||
type: 'hint',
|
||||
code: 'air-conditioned',
|
||||
text: 'air-conditioned vehicle'
|
||||
},
|
||||
r0: {
|
||||
type: 'hint',
|
||||
code: 'upward-escalator',
|
||||
text: 'upward escalator'
|
||||
},
|
||||
au: {
|
||||
type: 'hint',
|
||||
code: 'elevator',
|
||||
text: 'elevator available'
|
||||
}
|
||||
})
|
||||
|
||||
// todo: is passing in profile necessary?
|
||||
const parseHint = (profile, h) => {
|
||||
// todo: C
|
||||
|
||||
const text = h.txtN && h.txtN.trim() || ''
|
||||
|
||||
if (h.type === 'M') {
|
||||
return {
|
||||
type: 'status',
|
||||
code: h.code || null,
|
||||
summary: h.txtS && h.txtS.trim() || '',
|
||||
text
|
||||
}
|
||||
}
|
||||
if (h.type === 'D') {
|
||||
return {
|
||||
type: 'status',
|
||||
code: h.code || null,
|
||||
text
|
||||
}
|
||||
}
|
||||
|
||||
// todo: find sth more reliable than this
|
||||
if (h.type === 'P' && text.toLowerCase() === 'journey cancelled') {
|
||||
return {
|
||||
type: 'status',
|
||||
code: 'journey-cancelled',
|
||||
text
|
||||
// todo: `h.sIdx`
|
||||
}
|
||||
}
|
||||
if (h.type === 'U' && text.toLowerCase() === 'stop cancelled') {
|
||||
return {
|
||||
type: 'status',
|
||||
code: 'stop-cancelled',
|
||||
text
|
||||
}
|
||||
}
|
||||
// todo:
|
||||
// {
|
||||
// "type": "U",
|
||||
// "code": "",
|
||||
// "icoX": 3,
|
||||
// "txtN": "entrance and exit not possible"
|
||||
// }
|
||||
if (h.type === 'U') {
|
||||
return {
|
||||
type: 'status',
|
||||
code: h.code || null,
|
||||
text
|
||||
}
|
||||
}
|
||||
|
||||
if (h.type === 'L') {
|
||||
return {
|
||||
type: 'status',
|
||||
code: 'alternative-trip',
|
||||
text,
|
||||
journeyId: h.jid
|
||||
}
|
||||
}
|
||||
if (h.type === 'A') {
|
||||
return hints[h.code && h.code.trim().toLowerCase()] || null
|
||||
}
|
||||
if (h.type === 'R') {
|
||||
// todo: how can we identify the individual types?
|
||||
return {
|
||||
type: 'status',
|
||||
code: h.code,
|
||||
text
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
module.exports = parseHint
|
|
@ -4,7 +4,7 @@ module.exports = {
|
|||
dateTime: require('./date-time'),
|
||||
location: require('./location'),
|
||||
line: require('./line'),
|
||||
remark: require('./remark'),
|
||||
hint: require('./hint'),
|
||||
operator: require('./operator'),
|
||||
stopover: require('./stopover'),
|
||||
journeyLeg: require('./journey-leg'),
|
||||
|
|
|
@ -1,13 +1,32 @@
|
|||
'use strict'
|
||||
|
||||
const parseDateTime = require('./date-time')
|
||||
const findRemark = require('./find-remark')
|
||||
|
||||
const clone = obj => Object.assign({}, obj)
|
||||
|
||||
const createParseJourneyLeg = (profile, stations, lines, remarks, polylines) => {
|
||||
// todo: finish parse/remark.js first
|
||||
const applyRemark = (j, rm) => {}
|
||||
const applyRemarks = (leg, hints, warnings, refs) => {
|
||||
for (let ref of refs) {
|
||||
const remark = findRemark(hints, warnings, ref)
|
||||
if ('number' === typeof ref.fLocX && 'number' === typeof ref.tLocX) {
|
||||
for (let i = ref.fLocX; i <= ref.tLocX; i++) {
|
||||
const stopover = leg.passed[i]
|
||||
if (Array.isArray(stopover.remarks)) {
|
||||
stopover.remarks.push(remark)
|
||||
} else {
|
||||
stopover.remarks = [remark]
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (Array.isArray(leg.remarks)) leg.remarks.push(remark)
|
||||
else leg.remarks = [remark]
|
||||
}
|
||||
// todo: `ref.tagL`
|
||||
}
|
||||
}
|
||||
|
||||
const createParseJourneyLeg = (profile, stations, lines, hints, warnings, polylines) => {
|
||||
// todo: pt.status
|
||||
// todo: pt.sDays
|
||||
// todo: pt.dep.dProgType, pt.arr.dProgType
|
||||
// todo: what is pt.jny.dirFlg?
|
||||
|
@ -15,6 +34,7 @@ const createParseJourneyLeg = (profile, stations, lines, remarks, polylines) =>
|
|||
// todo: what is pt.himL?
|
||||
|
||||
// j = journey, pt = part
|
||||
// todo: pt.planrtTS
|
||||
const parseJourneyLeg = (j, pt, parseStopovers = true) => {
|
||||
const dep = profile.parseDateTime(profile, j.date, pt.dep.dTimeR || pt.dep.dTimeS)
|
||||
const arr = profile.parseDateTime(profile, j.date, pt.arr.aTimeR || pt.arr.aTimeS)
|
||||
|
@ -63,9 +83,11 @@ const createParseJourneyLeg = (profile, stations, lines, remarks, polylines) =>
|
|||
const stopovers = pt.jny.stopL.map(parse)
|
||||
// filter stations the train passes without stopping, as this doesn't comply with fptf (yet)
|
||||
res.stopovers = stopovers.filter((x) => !x.passBy)
|
||||
|
||||
// todo: is there a `pt.jny.remL`?
|
||||
if (Array.isArray(pt.jny.msgL)) {
|
||||
applyRemarks(res, hints, warnings, pt.jny.msgL)
|
||||
}
|
||||
if (Array.isArray(pt.jny.remL)) {
|
||||
for (let remark of pt.jny.remL) applyRemark(j, remark)
|
||||
}
|
||||
|
||||
const freq = pt.jny.freq || {}
|
||||
|
|
|
@ -1,13 +1,20 @@
|
|||
'use strict'
|
||||
|
||||
const clone = obj => Object.assign({}, obj)
|
||||
const findRemark = require('./find-remark')
|
||||
|
||||
const createParseJourney = (profile, stations, lines, remarks, polylines) => {
|
||||
const parseLeg = profile.parseJourneyLeg(profile, stations, lines, remarks, polylines)
|
||||
const createParseJourney = (profile, stations, lines, hints, warnings, polylines) => {
|
||||
const parseLeg = profile.parseJourneyLeg(profile, stations, lines, hints, warnings, polylines)
|
||||
|
||||
// todo: c.sDays
|
||||
// todo: c.conSubscr
|
||||
// todo: c.trfRes x vbb-parse-ticket
|
||||
// todo: c.sotRating, c.isSotCon, c.sotCtxt
|
||||
// todo: c.showARSLink
|
||||
// todo: c.useableTime
|
||||
// todo: c.cksum
|
||||
// todo: c.isNotRdbl
|
||||
// todo: c.badSecRefX
|
||||
// todo: c.bfATS, c.bfIOSTS
|
||||
const parseJourney = (j) => {
|
||||
const legs = j.secL.map(leg => parseLeg(j, leg))
|
||||
const res = {
|
||||
|
@ -15,6 +22,14 @@ const createParseJourney = (profile, stations, lines, remarks, polylines) => {
|
|||
legs
|
||||
}
|
||||
|
||||
if (Array.isArray(j.msgL)) {
|
||||
res.remarks = []
|
||||
for (let ref of j.msgL) {
|
||||
const remark = findRemark(hints, warnings, ref)
|
||||
if (remark) res.remarks.push(remark)
|
||||
}
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const createParseMovement = (profile, locations, lines, remarks, polylines = []) => {
|
||||
const createParseMovement = (profile, locations, lines, hints, warnings, polylines = []) => {
|
||||
// todo: what is m.dirGeo? maybe the speed?
|
||||
// todo: what is m.stopL?
|
||||
// todo: what is m.proc? wut?
|
||||
|
@ -8,7 +8,7 @@ const createParseMovement = (profile, locations, lines, remarks, polylines = [])
|
|||
// todo: what is m.ani.dirGeo[n]? maybe the speed?
|
||||
// todo: what is m.ani.proc[n]? wut?
|
||||
const parseMovement = (m) => {
|
||||
const pStopover = profile.parseStopover(profile, locations, lines, remarks, m.date)
|
||||
const pStopover = profile.parseStopover(profile, locations, lines, hints, warnings, m.date)
|
||||
|
||||
const res = {
|
||||
direction: profile.parseStationName(m.dirTxt),
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
'use strict'
|
||||
|
||||
const parseRemark = (profile, r) => {
|
||||
return null // todo
|
||||
}
|
||||
|
||||
module.exports = parseRemark
|
|
@ -1,6 +1,10 @@
|
|||
'use strict'
|
||||
|
||||
const createParseStopover = (profile, stations, lines, remarks, date) => {
|
||||
const findRemark = require('./find-remark')
|
||||
|
||||
// todo: arrivalDelay, departureDelay or only delay ?
|
||||
// todo: arrivalPlatform, departurePlatform
|
||||
const createParseStopover = (profile, stations, lines, hints, warnings, date) => {
|
||||
const parseStopover = (st) => {
|
||||
const res = {
|
||||
type: 'stopover',
|
||||
|
@ -55,6 +59,14 @@ const createParseStopover = (profile, stations, lines, remarks, date) => {
|
|||
}
|
||||
}
|
||||
|
||||
if (Array.isArray(st.msgL)) {
|
||||
res.remarks = []
|
||||
for (let ref of st.msgL) {
|
||||
const remark = findRemark(hints, warnings, ref)
|
||||
if (remark) res.remarks.push(remark)
|
||||
}
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
|
|
35
parse/warning.js
Normal file
35
parse/warning.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
'use strict'
|
||||
|
||||
const brToNewline = require('br2nl')
|
||||
|
||||
const parseDateTime = require('./date-time')
|
||||
|
||||
// todo: is passing in profile necessary?
|
||||
const parseWarning = (profile, w) => {
|
||||
// todo: hid, act, pub, lead, tckr, icoX, fLocX, tLocX, prod, comp,
|
||||
// todo: cat (1, 2), pubChL
|
||||
// pubChL:
|
||||
// [ { name: 'timetable',
|
||||
// fDate: '20180606',
|
||||
// fTime: '073000',
|
||||
// tDate: '20180713',
|
||||
// tTime: '030000' },
|
||||
// { name: 'export',
|
||||
// fDate: '20180606',
|
||||
// fTime: '073000',
|
||||
// tDate: '20180713',
|
||||
// tTime: '030000' } ]
|
||||
|
||||
return {
|
||||
type: 'warning',
|
||||
summary: brToNewline(w.head),
|
||||
text: brToNewline(w.text),
|
||||
priority: w.prio,
|
||||
category: w.cat, // todo: parse to sth meaningful
|
||||
validFrom: parseDateTime(profile, w.sDate, w.sTime).toISO(),
|
||||
validUntil: parseDateTime(profile, w.eDate, w.eTime).toISO(),
|
||||
modified: parseDateTime(profile, w.lModDate, w.lModTime).toISO()
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = parseWarning
|
Loading…
Add table
Reference in a new issue