Skip to content

Commit

Permalink
feat(filterfirst): deprecate filterFirst function in favour of exclud…
Browse files Browse the repository at this point in the history
…eFirst

This function is confusing. Use excludeFirst instead, and invert the predicate.
  • Loading branch information
djcsdy committed Oct 9, 2022
1 parent 94feefd commit c7d1fc8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@ export function filterFn<T>(
return array => nativeFilter.call(array, predicate) as T[];
}

/** @deprecated This function is confusing, use {@link excludeFirst} instead,
* and invert the predicate. */
export function filterFirst<T>(
array: ArrayLike<T>,
predicate: (element: T, index: number) => boolean
Expand All @@ -345,6 +347,8 @@ export function filterFirst<T>(
return result;
}

/** @deprecated This function is confusing, use {@link excludeFirstFn} instead,
* and invert the predicate. */
export function filterFirstFn<T>(
predicate: (element: T, index: number) => boolean
): (array: ArrayLike<T>) => T[] {
Expand Down

0 comments on commit c7d1fc8

Please sign in to comment.