There's a similar question for LINQ: Is there an equivalent of None()
in LINQ?
There are some boolean methods on collections / arrays:
Array.some
(similar tolinq.Any
)Array.every
(similar tolinq.All
)
Can I check if no elements in array match a given function callback
A possible workaround is to .filter
and then check .length
and make sure it's zero:
let arr = ["a","b","c"]
// make sure that no item in array = "b"
let noBs = arr.filter(el => el === "b").length === 0