Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
rm unused imports in iterableUtils.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
helmturner authored Nov 26, 2023
1 parent d7c8dbc commit fba96cf
Showing 1 changed file with 0 additions and 67 deletions.
67 changes: 0 additions & 67 deletions src/async/iterableUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,88 +156,21 @@ export interface AsyncIterableEsque<T = unknown> {
[Symbol.asyncIterator](): AsyncIterator<T>;
}

export function isAsyncIterableEsque(
maybeAsyncIterable: unknown,
): maybeAsyncIterable is AsyncIterableEsque {
return (
!!maybeAsyncIterable &&
(typeof maybeAsyncIterable === "object" ||
typeof maybeAsyncIterable === "function") &&
Symbol.asyncIterator in maybeAsyncIterable
);
}

export interface IterableEsque<T = unknown> {
[Symbol.iterator](): Iterator<T>;
}

export function isIterableEsque(
maybeIterable: unknown,
): maybeIterable is IterableEsque {
return (
!!maybeIterable &&
(typeof maybeIterable === "object" ||
typeof maybeIterable === "function") &&
Symbol.iterator in maybeIterable
);
}

type SyncOrAsyncGeneratorFnEsque = AsyncGeneratorFnEsque | GeneratorFnEsque;

export function isMaybeAsyncGeneratorFn(
maybeAsyncGeneratorFn: unknown,
): maybeAsyncGeneratorFn is SyncOrAsyncGeneratorFnEsque {
return (
typeof maybeAsyncGeneratorFn === "function" &&
["AsyncGeneratorFunction", "GeneratorFunction"].includes(
maybeAsyncGeneratorFn.constructor.name,
)
);
}

export type GeneratorFnEsque = () => Generator;

export function isGeneratorFnEsque(
maybeGeneratorFn: unknown,
): maybeGeneratorFn is GeneratorFnEsque {
return (
typeof maybeGeneratorFn === "function" &&
maybeGeneratorFn.constructor.name === "GeneratorFunction"
);
}

export type AsyncGeneratorFnEsque = () => AsyncGenerator;

export function isAsyncGeneratorFnEsque(
maybeAsyncGeneratorFn: unknown,
): maybeAsyncGeneratorFn is AsyncGeneratorFnEsque {
return (
typeof maybeAsyncGeneratorFn === "function" &&
maybeAsyncGeneratorFn.constructor.name === "AsyncGeneratorFunction"
);
}

export type PromiseEsque = PromiseLike<unknown>;

export function isPromiseEsque(
maybePromise: unknown,
): maybePromise is PromiseEsque {
return (
!!maybePromise &&
typeof maybePromise === "object" &&
"then" in maybePromise &&
typeof maybePromise.then === "function"
);
}

export type ThunkEsque = () => unknown;

export function isThunkEsque(maybeThunk: unknown): maybeThunk is ThunkEsque {
return (
!!maybeThunk && typeof maybeThunk === "function" && maybeThunk.length === 0
);
}

export type Thunkable =
| AsyncIterableEsque
| IterableEsque
Expand Down

0 comments on commit fba96cf

Please sign in to comment.