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