filter out null items

This commit is contained in:
PAlexanderFranklin 2023-11-12 16:09:07 -08:00
parent 93dabd7398
commit 61fb5b8207

View File

@ -69,13 +69,14 @@ async function main() {
}, },
) )
let body = await res.json() let body = await res.json()
let trips = body?.data?.activities?.map(async (activity) => { let trips = body?.data?.activities
?.map(async (activity) => {
if (activity.formattedTotal == "$0.00") { if (activity.formattedTotal == "$0.00") {
return "" return null
} }
if (activity.type == "QUEST") { if (activity.type == "QUEST") {
// These are all duplicates of MISC items. // These are all duplicates of MISC items.
return "" return null
} }
if (activity.type == "MISC" || activity.activityTitle == "Delivery") { if (activity.type == "MISC" || activity.activityTitle == "Delivery") {
return { return {
@ -95,6 +96,7 @@ async function main() {
} }
return { unparsedActivity: activity } return { unparsedActivity: activity }
}) })
.filter((item) => item)
if (trips) { if (trips) {
let tripResults = await utils.settlePromises(trips) let tripResults = await utils.settlePromises(trips)
uberJSON = [...uberJSON, ...tripResults] uberJSON = [...uberJSON, ...tripResults]