1
0

sync local repositories

add booleanish predicates
enable custom inspection
default to sequence of any when sequence type is unknown
This commit is contained in:
2024-08-15 00:40:45 +02:00
parent aedad87c8e
commit 0b03475f66
7 changed files with 543 additions and 196 deletions

View File

@@ -2,6 +2,7 @@ import { AsyncSequence } from "./async/types.js";
import { Sequence } from "./sync/types.js";
export type Predicate<T> = (obj: T) => boolean;
export type AnyPredicate<T> = (obj: T) => unknown;
export type FilterPredicate<TElement, TFiltered extends TElement> = (obj: TElement) => obj is TFiltered;
export type Converter<TFrom, TTo> = (obj: TFrom) => TTo;
export type BiConverter<TFromFirst, TFromSecond, TTo> = (first: TFromFirst, second: TFromSecond) => TTo;
@@ -20,7 +21,9 @@ export type MaybeAsyncFunction<TFunc extends (...args: any) => any> = TFunc exte
export type MaybeAsyncSequence<T> = Sequence<T> | AsyncSequence<T>;
export type AsyncPredicate<T> = AsyncFunction<Predicate<T>>;
export type AsyncAnyPredicate<T> = AsyncFunction<AnyPredicate<T>>;
export type MaybeAsyncPredicate<T> = MaybeAsyncFunction<Predicate<T>>;
export type MaybeAsyncAnyPredicate<T> = MaybeAsyncFunction<AnyPredicate<T>>;
export type AsyncConverter<TFrom, TTo> = AsyncFunction<Converter<TFrom, TTo>>;
export type MaybeAsyncConverter<TFrom, TTo> = MaybeAsyncFunction<Converter<TFrom, TTo>>;
export type AsyncBiConverter<TFromFirst, TFromSecond, TTo> = AsyncFunction<BiConverter<TFromFirst, TFromSecond, TTo>>;