Skip to content

Commit 2781889

Browse files
committed
feat(filterfirst): deprecate filterFirst function in favour of excludeFirst
This function is confusing. Use excludeFirst instead, and invert the predicate. (cherry picked from commit c7d1fc8)
1 parent d6f5f53 commit 2781889

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,8 @@ export function filterFn<T>(
324324
return array => nativeFilter.call(array, predicate);
325325
}
326326

327+
/** @deprecated This function is confusing, use {@link excludeFirst} instead,
328+
* and invert the predicate. */
327329
export function filterFirst<T>(
328330
array: ArrayLike<T>,
329331
predicate: (element: T, index: number) => boolean
@@ -344,6 +346,8 @@ export function filterFirst<T>(
344346
return result;
345347
}
346348

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

0 commit comments

Comments
 (0)