Skip to content

Commit 6f35e90

Browse files
committed
fix(compat/find): keep doesMatch param name
1 parent d156d7f commit 6f35e90

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/compat/array/find.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export function find<T extends object>(
8888
*
8989
* @template T
9090
* @param collection - The source array or object to search through.
91-
* @param predicate - The criteria to match. It can be a function, a partial object, a key-value pair, or a property name.
91+
* @param [doesMatch=identity] - The criteria to match. It can be a function, a partial object, a key-value pair, or a property name.
9292
* @param [fromIndex=0] - The index to start the search from, defaults to 0.
9393
* @returns The first property value that has the specified property, or `undefined` if no match is found.
9494
*
@@ -100,7 +100,11 @@ export function find<T extends object>(
100100
*/
101101
export function find<T>(
102102
collection: ArrayLike<T> | Record<any, any> | null | undefined,
103-
predicate: ((item: T, index: number, arr: any) => unknown) | Partial<T> | [keyof T, unknown] | PropertyKey = identity,
103+
_doesMatch:
104+
| ((item: T, index: number, arr: any) => unknown)
105+
| Partial<T>
106+
| [keyof T, unknown]
107+
| PropertyKey = identity,
104108
fromIndex = 0
105109
): T | undefined {
106110
if (!collection) {
@@ -110,7 +114,7 @@ export function find<T>(
110114
fromIndex = Math.max(collection.length + fromIndex, 0);
111115
}
112116

113-
const doesMatch = iteratee(predicate);
117+
const doesMatch = iteratee(_doesMatch);
114118
if (!Array.isArray(collection)) {
115119
const keys = Object.keys(collection) as Array<keyof T>;
116120

0 commit comments

Comments
 (0)