# tymer

> simple event timer

Latest version **1.2.1** (published 2017-05-19) · ISC license · 0 weekly downloads

## Install

```sh
npm install tymer
pnpm add tymer
yarn add tymer
bun add tymer
```

## 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.2.1 |
| Published | 2017-05-19 |
| First published | 2016-07-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | tony-kerz |

## Links

- npm: https://www.npmjs.com/package/tymer
- Repository: https://github.com/tony-kerz/tymer
- Homepage: https://github.com/tony-kerz/tymer#readme
- Issues: https://github.com/tony-kerz/tymer/issues
- npm.io page: https://npm.io/package/tymer

## Dependencies (1)

- [debug](https://npm.io/package/debug.md) ^2.6.4

## Recent versions

- 1.2.1 (latest) — 2017-05-19
- 1.1.3 — 2017-04-30
- 1.1.2 — 2017-04-30
- 1.1.1 — 2017-04-27
- 1.1.0 — 2017-04-27
- 1.0.3 — 2017-04-25
- 1.0.2 — 2016-07-17

## README

# tymer

this simple component allows for geocoding from various providers

[![Build Status](https://travis-ci.org/tony-kerz/tymer.svg?branch=tk%2Ftravis)](https://travis-ci.org/tony-kerz/tymer)

## usage

### import
```
import Timer from 'tymer'
```

### stop
```
// timer is automatically started on construction
//
const timer = new Timer('some-event')

// some event occurs here

timer.stop()
```

### explicit start
```
const timer = new Timer('some-event')

const array = [1, 2, 3]
for (let i = 0; i < array.length; i++) {
  timer.start()
  // do stuff
  timer.stop()
}
```

### lap
```
const timer = new Timer('some-event')

// some event occurs here

timer.lap() // lap() stops and then immediately starts

// other event here

timer.stop()
```

### async
```
const parentTimer = new Timer('some-event')

something().then(()=>{
  const childTimer = new Timer()
  // some event
  childTimer.stop()
  // need child timer to track time spent in async segment
  parentTimer.record(childTimer.last())
})
```

### report
```
console.log('timer: report=%o', timer.toString())
```
```
some-event: count=1, min=0.014, max=0.048, max2=0.031, last=0.015, avg=0.026, avg2=0.021, total=0.000s
```
> `max2` is the second max, and `avg2` is the average without the max.

> this is to provide insight into loops where the first call incurs an initialization cost.

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