CollectionFilter

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

Returns: object

Usage

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

Arguments

Argument Description Default
collection
(object, required)

collection to filter entries from

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