@types/nanobench
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

Installation

npm install --save @types/nanobench

Summary

This package contains type definitions for nanobench (https://github.com/mafintosh/nanobench).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/nanobench.

index.d.ts

interface Benchmark {
    /**
     * Start the benchmark. If not called the bench will be tracked from the beginning of the function.
     */
    start(): void;

    /**
     * End the benchmark. Returns the time elapsed in milliseconds.
     */
    end(): number;

    /**
     * Returns the time elapsed in milliseconds.
     */
    elapsed(): number;

    /**
     * Benchmark failed. Report error.
     */
    error(err: Error): void;

    /**
     * Log out a message.
     */
    log(msg: unknown): void;
}

type RunFn = (b: Benchmark) => unknown;

declare const nanobench: {
    /**
     * Add a new benchmark. `run` is called with a {@link Benchmark} object.
     */
    (name: string, run: RunFn): void;

    /**
     * Skip a benchmark.
     */
    skip: (name: string, run: RunFn) => void;

    /**
     * Only run this benchmark.
     */
    only: (name: string, run: RunFn) => void;
};

export = nanobench;

Additional Details

  • Last updated: Thu, 18 Jan 2024 19:06:37 GMT
  • Dependencies: none

Credits

These definitions were written by Evan Hahn.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/nanobench

Weekly Downloads

154

Version

3.0.0

License

MIT

Unpacked Size

4.37 kB

Total Files

5

Last publish

Collaborators

  • types