@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.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
3.0.0469ts5.6
3.0.0469latest
3.0.0469ts4.6
3.0.0469ts4.7
3.0.0469ts4.8
3.0.0469ts4.9
3.0.0469ts5.0
3.0.0469ts5.1
3.0.0469ts5.2
3.0.0469ts5.3
3.0.0469ts5.4
3.0.0469ts5.5
3.0.0469ts5.7

Version History

VersionDownloads (Last 7 Days)Published
3.0.0469

Package Sidebar

Install

npm i @types/nanobench

Weekly Downloads

469

Version

3.0.0

License

MIT

Unpacked Size

4.37 kB

Total Files

5

Last publish

Collaborators

  • types