I have this simple situation where I want to filter and map to the same value, like so:
const files = results.filter(function(r){
return r.file;
})
.map(function(r){
return r.file;
});
To save lines of code, as well as increase performance, I am looking for:
const files = results.filterAndMap(function(r){
return r.file;
});
does this exist, or should I write something myself? I have wanted such functionality in a few places, just never bothered to look into it before.