UNPKG

@ibgib/helper-gib

Version:

common helper/utils/etc used in ibgib libs. Node v19+ needed for heavily-used isomorphic webcrypto hashing consumed in both node and browsers.

89 lines 3.49 kB
import { MaybeAsyncFn, Reckoning, RespecGib, RespecInfo, RespecOptions } from "./respec-gib-types.mjs"; /** * This global object via `globalThis.respecGib` contains the * state of respec(s) to be/being/been executed. * * @returns the current respecGib object */ export declare function getGlobalRespecGib(): RespecGib; /** * gets the most recent non-nested (non-subblock) respecInfo from the global * state for the given `title`. * * @param title unique to file, use import.meta.url * @returns respecInfo for the given `title` */ export declare function getRespec(title: string): RespecInfo; /** * gets the most recent non-complete sub-block or if none, returns the * incoming respecInfo block. * * @param block root respecInfo block */ export declare function getActiveRespecfullyBlock(block: RespecInfo): RespecInfo; export declare function openRespecfullyBlock(block: RespecInfo): Promise<void>; export declare function closeRespecBlock(block: RespecInfo, logalot?: boolean): Promise<void>; export declare function respecfully(title: string, label: string, fn: MaybeAsyncFn, opts?: RespecOptions): Promise<void>; export declare function respecfullyDear(title: string, label: string, fn: MaybeAsyncFn, opts?: RespecOptions): Promise<void>; /** * Execute this function ONCE before the FIRST ifWe block is executed. * * @param title unique to file, use import.meta.url * @param fn to execute * @param logalot true for verbose trace logging */ export declare function firstOfAll(title: string, fn: MaybeAsyncFn, logalot?: boolean): void; /** * Execute this function before EACH & EVERY ifWe block is executed. * * @param title unique to file, use import.meta.url * @param fn to execute * @param logalot true for verbose trace logging */ export declare function firstOfEach(title: string, fn: MaybeAsyncFn, logalot?: boolean): void; /** * Execute this function ONCE AFTER the LAST ifWe block is executed. * * @param title unique to file, use import.meta.url * @param fn to execute * @param logalot true for verbose trace logging */ export declare function lastOfAll(title: string, fn: MaybeAsyncFn, logalot?: boolean): void; /** * Execute this function AFTER EACH & EVERY ifWe block is executed. * * @param title unique to file, use import.meta.url * @param fn to execute * @param logalot true for verbose trace logging */ export declare function lastOfEach(title: string, fn: MaybeAsyncFn, logalot?: boolean): void; /** * Respeculation block that should contain reckonings (iReckon functions). * * ## notes * * you can't... * * add firstOfEach/All after the first of these blocks * * add respecfully blocks inside this block * * nest these blocks * * @param title unique to file, use import.meta.url * @param label label of respec * @param fn to execute * @param logalot true for verbose trace logging */ export declare function ifWe(title: string, label: string, fn: MaybeAsyncFn, opts?: RespecOptions): Promise<void>; export declare function ifWeMight(title: string, label: string, fn: MaybeAsyncFn, opts?: RespecOptions): Promise<void>; /** * starts a reckoning on what you figure. * * ## notes * * * this is similar to an expectation or assertion in other worlds, but way better. * * @param title unique to file, use import.meta.url * @param x value to test against this.value * @returns the reckoning instance */ export declare function iReckon(title: string, x: any): Reckoning; //# sourceMappingURL=respec-gib.d.mts.map