UNPKG

@newdash/newdash

Version:

javascript/typescript utility library

21 lines (20 loc) 559 B
import type { AsyncFunction, GeneralFunction } from "../types"; /** * time the executing time for sync/async function * * @category Functional * @since 5.19.0 * @param fn execution function * @returns the consumed milliseconds of the function execution * * @example * * ```js * const consumedMSeconds = await timeIt(async () => { * // some async operations * }) * ``` */ export declare function timeIt(fn: AsyncFunction<[], void>): Promise<number>; export declare function timeIt(fn: GeneralFunction<[], void>): number; export default timeIt;