CollectionEvery

This function calls a given closure/function with every element in a given collection and returns true, if all of the closure calls returns true.

CollectionEvery( collection, closure [, parallel [, maxThreads ] ] )

Returns: Boolean

Argument Description Default
collection
object, required

collection to iterate

Alias: object

closure
function, required

function/closure that implements the following constructor [function(... depends on the given collection ...):boolean].

Alias: function, callback, udf

parallel
boolean, optional

execute closures parallel

maxThreads
number, optional

maximum number of threads executed, ignored when argument "parallel" is set to false

20

Examples

people = [ { name = "Alice", age = 32 }, { name = "Bob", age = 29 }, { name = "Eve", age = 41 }];
dump(CollectionEvery(people, function(p) { return p.age > 20; })); // true
// member function
dump(people.every(function(p) { return p.age > 30; })); // false

See also