Skip to content

Commit

Permalink
fix(filter-array): add index to filterFn
Browse files Browse the repository at this point in the history
  • Loading branch information
nartc committed Sep 18, 2023
1 parent 63bf5ad commit dcf7753
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions libs/ngxtension/filter-array/src/filter-array.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { map } from 'rxjs';

export const filterArray = <T>(filterFn: (item: T) => boolean) => {
return map((array: T[]) => array.filter((item) => filterFn(item)));
};
export const filterArray = <T>(filterFn: (item: T, index: number) => boolean) =>
map((array: T[]) => array.filter((item, index) => filterFn(item, index)));

0 comments on commit dcf7753

Please sign in to comment.