UNPKG

@lou.codes/predicates

Version:
21 lines (20 loc) 606 B
import { isAsyncIterable } from "./isAsyncIterable.js"; import { isIterable } from "./isIterable.js"; /** * Check if given value is `IsomorphicIterable` (either `Iterable` or * `AsyncIterable`). * * **Not to be confused with `isAsyncIterable` which only checks for * `AsyncIterable`.** * * @category Iterables * @example * ```typescript * isIterable([]); // true * isIterable({}); // false * ``` * @param input Value to check. * @returns `true` when is an `IsomorphicIterable`, `false` otherwise. */ export const isIsomorphicIterable = input => isIterable(input) || isAsyncIterable(input);