# tiny-stopwatch

> Tiny replacement for console.time() and console.timeEnd()

Latest version **1.0.22** (published 2019-12-09) · ISC license · 0 weekly downloads

## Install

```sh
npm install tiny-stopwatch
pnpm add tiny-stopwatch
yarn add tiny-stopwatch
bun add tiny-stopwatch
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.22 |
| Published | 2019-12-09 |
| First published | 2019-12-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Jakub Telec |
| Maintainers | jakubtelec |
| Keywords | stopwatch, timer |

## Links

- npm: https://www.npmjs.com/package/tiny-stopwatch
- Repository: https://github.com/jakubtelec/tiny-stopwatch
- Homepage: https://github.com/jakubtelec/tiny-stopwatch#readme
- Issues: https://github.com/jakubtelec/tiny-stopwatch/issues
- npm.io page: https://npm.io/package/tiny-stopwatch

## Recent versions

- 1.0.22 (latest) — 2019-12-09
- 1.0.21 — 2019-12-06
- 1.0.2 — 2019-12-06
- 1.0.1 — 2019-12-05
- 1.0.0 — 2019-12-04

## README

### What does it do?

It measueres time passed since moment of its initialization. In seconds, because we are humans.

### Why?

To avoid annoying `missing/duplicated labels` errors and inconvenient syntax when triggering `console.time()` and `console.timeEnd()` in async JS code. Since I'm using this tiny snippet in many projects it's better to keep it - and share - as a separated package.

### How?

install:

```bash
yarn add tiny-stopwatch
```

or

```bash
npm i tiny-stopwatch
```

then:

```javascript
import TinyStopwatch from "tiny-stopwatch";
// or const TinyStopwatch = require('tiny-stopwatch');

console.log("Big Bang!");
const timer = new TinyStopwatch(); // creating instance initializes stopwatch

//
// some time consuming stuff
//

console.log("Time passed since Big Bang!: " + timer.getInterval() + "s");

//
// another time consuming stuff
//

console.log("Time passed since Big Bang!: " + timer.getInterval() + "s");

console.log("Big Bang, once again!");
timer.reset(); // reinitializes stopwatch
```

---
_Source: https://npm.io/package/tiny-stopwatch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
