Velopark: drop data if undefined

This commit is contained in:
Pieter Vander Vennet 2024-04-30 17:55:21 +02:00
parent dd46bfdf3b
commit d4367e017a

View file

@ -331,6 +331,9 @@ export default class LinkedDataLoader {
return
}
output[key] = output[key].map((v) => applyF(v))
if(!output[key].some(v => v !== undefined)){
delete output[key]
}
}
function asBoolean(key: string, invert: boolean = false) {
@ -379,6 +382,7 @@ export default class LinkedDataLoader {
}
return "€" + Number(p)
})
if (output["charge"] && output["timeUnit"]) {
const duration =
Number(output["chargeEnd"] ?? "1") - Number(output["chargeStart"] ?? "0")