Filter after map for next use reduce.
npm install -S @jswork/next-filter-map
import '@jswork/next-filter-map';
const options = [
{ name: 'One', assigned: true },
{ name: 'Two', assigned: false },
{ name: 'Three', assigned: true }
];
const reduced = nx.filterMap(
options,
(item) => {
return [item.assigned, { name: item.name }];
}
);
// [ { name: 'One' }, { name: 'Three' } ]
Code released under the MIT license.