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.