Skip to content

afeiship/next-filter-map

Repository files navigation

next-filter-map

Filter after map for next use reduce.

version license size download

installation

npm install -S @jswork/next-filter-map

usage

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' } ]

license

Code released under the MIT license.