doddle
Version:
Tiny yet feature-packed (async) iteration toolkit.
39 lines • 2.25 kB
TypeScript
import { type Doddle, type DoddleAsync } from "./doddle/index.js";
import type { DoddleReadableStream } from "./readable-stream-polyfill.js";
export declare function _iter<T>(input: Iterable<T>): Iterator<T>;
export declare function _aiter<T>(input: AsyncIterable<T>): AsyncIterator<T>;
export declare function _xiter<T>(input: Iterable<T> | AsyncIterable<T>): Iterator<T> | AsyncIterator<T>;
export declare function isObject<T>(value: T): value is T & {};
export declare function isFunction(value: any): value is (...args: any[]) => any;
export declare function isArrayLike<T>(value: any): value is ArrayLike<T>;
export declare function isIterable<T>(value: any): value is Iterable<T>;
export declare const orderedStages: readonly [undefined, "before", "after", "both"];
export declare const isInt: (number: unknown) => boolean;
export declare const isBool: (value: boolean) => boolean;
export declare const isPair: (value: any) => boolean;
export declare const isPosInt: (value: number) => boolean;
export declare const enum Stage {
Before = 1,
After = 2,
Both = 3
}
export declare function isAsyncIterable<T>(value: any): value is AsyncIterable<T>;
export declare function isReadableStream(value: any): value is DoddleReadableStream<unknown>;
export declare function isNextable<T>(value: any): value is Iterator<T> | AsyncIterator<T>;
export declare function getClassName(something: any): string;
export declare function getValueDesc(object: any): string | undefined;
/**
* Checks if the given value is a thenable.
*
* @param what The value to check.
*/
export declare function isThenable<T = unknown>(what: unknown): what is PromiseLike<T>;
export declare function isDoddle<T>(value: any): value is Doddle<T>;
export declare function returnKvp(input: any, key: any, value: any): any[] | PromiseLike<any[]>;
export type MaybePromise<T> = T | PromiseLike<T>;
export type MaybeDoddle<T> = T | Doddle<T>;
export type MaybeDoddleAsync<T> = T | Doddle<T> | DoddleAsync<T>;
export declare function shuffleArray<T>(array: T[]): T[];
export declare function createCompare(desc: boolean): (a: any, b: any) => number;
export declare function createCompareKey(desc: boolean): (a: any, b: any) => number;
//# sourceMappingURL=utils.d.ts.map