Maps values in a collection
collectionMap(collection, closure [, parallel] [, maxThreads])
→ returns any
20
coll = [{
id: 0,
firstname: 'Arthur',
name: 'Dent'
},{
id: 1,
firstname: 'Harry',
name: 'Potter'
},{
id: 2,
firstname: 'Peter',
name: 'Jackson'
}];
users = collectionMap(coll,function(item) {
return {
id: item.id,
fullname: item.firstname&' '&item.name
};
});
for(user in users) {
writeOutput(user.fullname&', ');
}
Expected Result: Arthur Dent, Harry Potter, Peter Jackson,
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.