I need to check if a string has any indexOf of a few values. I would like to avoid things like this:
let filter = tasks.filter(
x =>
x.eventData.workflow_name === brand &&
(x.eventData.task_queue_name.indexOf('Value1') == -1 &&
x.eventData.task_queue_name.indexOf('_Value2') == -1 &&
x.eventData.task_queue_name.indexOf('Value3') == -1 &&
x.eventData.task_queue_name.indexOf('BANG_Value4') == -1)
)
I was trying to create an array like const VALUES_TO_SKIP = ['Value1', ...]
and write indexOf condition in a single line.
Is possible to avoid a bunch of value.indexOf(...)
?