UNPKG

@daiso-tech/core

Version:

The library offers flexible, framework-agnostic solutions for modern web applications, built on adaptable components that integrate seamlessly with popular frameworks like Next Js.

44 lines 981 B
/** * @module Utilities */ import { isInvokable, resolveInvokable, } from "../../utilities/functions/invokable.js"; import {} from "../../utilities/types/promiseable.type.js"; /** * @internal */ export function isLazy(lazyable) { return isInvokable(lazyable); } /** * @internal */ export function isPromiseLike(value) { return (typeof value === "object" && // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access typeof value?.then === "function"); } /** * @internal */ export function isAsyncLazy(lazyable) { return isInvokable(lazyable); } /** * @internal */ export function resolveLazyable(lazyable) { if (isLazy(lazyable)) { return resolveInvokable(lazyable)(); } return lazyable; } /** * @internal */ export async function resolveAsyncLazyable(lazyable) { if (isAsyncLazy(lazyable)) { return await resolveInvokable(lazyable)(); } return lazyable; } //# sourceMappingURL=lazy.js.map