A minimal, zero-dependency timer utility for Node.js and the browser. Current stable version 0.0.4 (unreleased release cadence). Tiny-tim provides a simple timer that returns elapsed time in configurable units (ms, s, m, h) with optional suffix. Its key differentiator is extreme small size (156 bytes minified) and simplicity, offering a single function that creates a reusable stopwatch. Compiled with babili for both ES6+ and CommonJS environments. No dependencies, suitable for lightweight instrumentation.
npm install tiny-timNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a reusable timer, demonstrates returning elapsed time with suffix as string and without suffix as number.
Check the type of the returned value if relying on specific data type.
Recreate the timer for a new measurement; cannot restart an existing timer.
Use only 'ms', 's', 'm', or 'h'.
Validate unit string before passing to timer().
Use 'import timer from "tiny-tim"' instead of 'import { timer } from "tiny-tim"'.Use 'const timer = require("tiny-tim")' directly without .default.Run 'npm install tiny-tim' in your project root.
No dependency data recorded yet.