-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renamed promiseRaceTo to promiseSome, prettier autofix
- Loading branch information
Showing
8 changed files
with
82 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ type Category = { | |
items: string[]; | ||
}; | ||
|
||
export default Category; | ||
export default Category; |
4 changes: 2 additions & 2 deletions
4
.github/actions/javascript/authorChecklist/categories/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import newComponent from './newComponentCategory'; | ||
import Category from './Category'; | ||
import newComponent from './newComponentCategory'; | ||
|
||
const categories: Category[] = [newComponent]; | ||
|
||
export default categories; | ||
export default categories; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Like _.some but for promises. It short-circuts after a promise fulfills with a value that passes the test implemented by provided function. | ||
* It does not wait for the other promises to complete once it finds one. | ||
* If no promise passes the provided test, it rejects. | ||
*/ | ||
export default function promiseSome<T>(promises: Array<Promise<T>>, callbackFn: (arg0: T) => boolean): Promise<boolean> { | ||
return new Promise((resolve, reject) => { | ||
for (const p of promises) { | ||
Promise.resolve(p) | ||
.then((res) => { | ||
if (!callbackFn(res)) { | ||
return; | ||
} | ||
resolve(true); | ||
}) | ||
.catch(() => {}); | ||
} | ||
Promise.allSettled(promises).then(() => reject()); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters