Hi,
I'm using the TransportAPI to pull the next train departures from a station to a destination. There's multiple destinations (trains) I can take but one of them, the Weybridge one is 1h20 so I would like to exclude it from my next trains. The object comes in a form of arrays for the next trains, and I would like to delete an entire array that contains the destination_name "Weybridge" as shown in the screenshot.
I've been looking for hours and managed to get somewhere with this but it deleted the message rather than deleting the entire array.
if (msg.payload.departures.all[0].destination_name == "Weybridge") {
delete msg.payload.departures.all[0];
}
Thanks for your help!