CollectionFilter

This function creates a new collection that returns all entries from an collection that match the given filter.

CollectionFilter( collection, filter [, parallel [, maxThreads ] ] )

Returns: object

Argument Description Default
collection
object, required

collection to filter entries from

Alias: object

filter
function, required

filter can be a function/closure that implements the following constructor [function(... depending on given collection ...):boolean].

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(CollectionFilter(people, function(p) { return p.age > 30; }));
// member function
dump(people.filter(function(p) { return p.age > 30; }));

See also