I've created a filter that checks for events happening today at certain venues using an events API. The filter works, but it seems ripe for refactoring given the repetition of event.venue.name
This is my code:
const tomorrow = moment()
.add(1, "days")
.format("LL");
const optimalVenuesWithEventsTomorrow = eventsData.events.filter(
event =>
moment(event.datetime_local).format("LL") === tomorrow &&
(event.venue.name === "Fenway Park" ||
event.venue.name === "TD Garden" ||
event.venue.name === "Charles Playhouse" ||
event.venue.name === "Citizens Bank Opera House" ||
event.venue.name === "House of Blues - Boston" ||
event.venue.name === "Orpheum Theatre" ||
event.venue.name === "Shubert Theatre")
);
This seems like a simple problem of moving the parentheses around to adjust the logic. I've tried that, but end up breaking the logic. What am I missing?
Thanks!