…or what’s the proper name for some() and every(). Basically, I’m looking for a function or a plugin that would allow me to write something like:
okay = $("#myForm input").every(function() {
return $(this).val().length > 0
})
or
hasErrors = $(listOfUsers).some(function() {
return this.errorCount > 0;
})
You got the idea.
(Before the what-have-you-tried squad arrives, I googled and found jquery.arrayUtils, but that code doesn’t look convincing to me).
A simple, straightforward implementation:
With ES5, arrays already provide the methods
everyandsome, so you could achieve the same with built in methods:but it won’t work in older IE version without HTML5 shim.