Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/compat/array/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Filters characters in a string based on the predicate function.
*
* @param collection - The string to filter
* @param predicate - The function to test each character
* @param [predicate] - The function to test each character
* @returns An array of characters that pass the predicate test
*
* @example
Expand Down Expand Up @@ -40,7 +40,7 @@
* Filters elements in an array-like object based on the predicate.
*
* @param collection - The array-like object to filter
* @param predicate - The function or shorthand to test each element
* @param [predicate] - The function or shorthand to test each element
* @returns An array of elements that pass the predicate test
*
* @example
Expand Down Expand Up @@ -72,7 +72,7 @@
* Filters values in an object based on the predicate.
*
* @param collection - The object to filter
* @param predicate - The function or shorthand to test each value
* @param [predicate] - The function or shorthand to test each value
* @returns An array of values that pass the predicate test
*
* @example
Expand Down Expand Up @@ -110,8 +110,8 @@
* // => [{ a: 2 }]
*/
export function filter<T>(
source: ArrayLike<T> | Record<any, any> | null | undefined,

Check warning on line 113 in src/compat/array/filter.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type

Check warning on line 113 in src/compat/array/filter.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
predicate: ((item: T, index: number, arr: any) => unknown) | Partial<T> | [keyof T, unknown] | PropertyKey = identity

Check warning on line 114 in src/compat/array/filter.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
): T[] {
if (!source) {
return [];
Expand Down
14 changes: 7 additions & 7 deletions src/compat/array/find.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
* @param collection - The array-like object to search
* @param predicate - The type guard function to test each element
* @param fromIndex - The index to start searching from
* @param [fromIndex] - The index to start searching from
* @returns The first element that matches the type guard, or undefined if none found
*
* @example
Expand All @@ -27,8 +27,8 @@
* Finds the first element in an array-like object that matches a predicate.
*
* @param collection - The array-like object to search
* @param predicate - The function or shorthand to test each element
* @param fromIndex - The index to start searching from
* @param [predicate] - The function or shorthand to test each element
* @param [fromIndex] - The index to start searching from
* @returns The first matching element, or undefined if none found
*
* @example
Expand All @@ -49,7 +49,7 @@
*
* @param collection - The object to search
* @param predicate - The type guard function to test each value
* @param fromIndex - The index to start searching from
* @param [fromIndex] - The index to start searching from
* @returns The first value that matches the type guard, or undefined if none found
*
* @example
Expand All @@ -66,8 +66,8 @@
* Finds the first value in an object that matches a predicate.
*
* @param collection - The object to search
* @param predicate - The function or shorthand to test each value
* @param fromIndex - The index to start searching from
* @param [predicate] - The function or shorthand to test each value
* @param [fromIndex] - The index to start searching from
* @returns The first matching value, or undefined if none found
*
* @example
Expand All @@ -88,7 +88,7 @@
*
* @template T
* @param source - The source array or object to search through.
* @param doesMatch - The criteria to match. It can be a function, a partial object, a key-value pair, or a property name.
* @param [doesMatch=identity] - The criteria to match. It can be a function, a partial object, a key-value pair, or a property name.
* @param [fromIndex=0] - The index to start the search from, defaults to 0.
* @returns The first property value that has the specified property, or `undefined` if no match is found.
*
Expand All @@ -99,9 +99,9 @@
* console.log(result); // { id: 1, name: 'Alice' }
*/
export function find<T>(
source: ArrayLike<T> | Record<any, any> | null | undefined,

Check warning on line 102 in src/compat/array/find.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type

Check warning on line 102 in src/compat/array/find.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
_doesMatch:
| ((item: T, index: number, arr: any) => unknown)

Check warning on line 104 in src/compat/array/find.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
| Partial<T>
| [keyof T, unknown]
| PropertyKey = identity,
Expand Down