Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4fe9761
commit 35ad820
Showing
3 changed files
with
28 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import type { Fn, Fn0, Fn2 } from "./fn.js"; | ||
|
||
export type MaybePromise<T> = T | Promise<T>; | ||
|
||
export type MaybeAsyncIterable<T> = Iterable<T> | AsyncIterable<T>; | ||
|
||
export type MaybeAsyncGenerator<T> = | ||
| IterableIterator<T> | ||
| AsyncIterableIterator<T>; | ||
|
||
export type AsyncPredicate<T> = Fn<T, Promise<boolean>>; | ||
|
||
export type AsyncPredicate2<T> = Fn2<T, T, Promise<boolean>>; | ||
|
||
export type AsyncStatefulPredicate<T> = Fn0<AsyncPredicate<T>>; | ||
|
||
export type AsyncStatefulPredicate2<T> = Fn0<AsyncPredicate2<T>>; | ||
|
||
/** | ||
* Async version of {@link identity}. | ||
* | ||
* @param x | ||
*/ | ||
export const asyncIdentity = async <T>(x: T) => x; |
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