Filters items from a collection passing the filter condition
collectionFilter(collection, filter [, parallel] [, maxThreads])
returns any
Name | Type | Required | Default | Description |
---|---|---|---|---|
collection | any | Yes | ||
filter | function | Yes | ||
parallel | boolean | No | ||
maxThreads | numeric | No | 20 |
coll = [{
id: 0,
type: 'mail'
},{
id: 1,
type: 'mail'
},{
id: 2,
type: 'comment'
}];
onlyMails = collectionFilter(coll,function(item) {
return item.type is 'mail';
});
for(mail in onlyMails) {
writeOutput(mail.id&', ');
}