Skip to content

Commit

Permalink
fixed find method for async case
Browse files Browse the repository at this point in the history
j50n committed Oct 5, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 3cac380 commit 9758731
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/enumerable.ts
Original file line number Diff line number Diff line change
@@ -317,10 +317,10 @@ export class Enumerable<T> implements AsyncIterable<T> {
* @returns The first item that satisfies the testing function, or `undefined`.
*/
async find(
findFn: (element: T) => boolean | Promise<boolean>,
findFn: (element: T) => unknown | Promise<unknown>,
): Promise<T | undefined> {
for await (const element of this.iter) {
if (findFn(element)) {
if (await findFn(element)) {
return element;
}
}
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"0.20.44"}
{"version":"0.20.45"}

0 comments on commit 9758731

Please sign in to comment.