@kikobeats/time-span

1.0.5 • Public • Published

time-span

Last version Coverage Status NPM Status

A zero dependencies high resolution timing function.

Install

$ npm install @kikobeats/time-span --save

Usage

const { setTimeout } = require('timers/promises')
const timeSpan = require('@kikobeats/time-span')()

const duration = timeSpan()
await setTimeout(5000)

console.log(duration()) // => 5001.870375

It also accepts a format function:

const timeSpan = require('@kikobeats/time-span')({
  format: n => `${Math.round(n)}ms`
})

const duration = timeSpan()
await setTimeout(5000)
console.log(duration()) // => 5000ms

License

time-span © Kiko Beats, released under the MIT License.
Authored and maintained by Kiko Beats with help from contributors.

kikobeats.com · GitHub Kiko Beats · Twitter @Kikobeats

Package Sidebar

Install

npm i @kikobeats/time-span

Weekly Downloads

24,566

Version

1.0.5

License

MIT

Unpacked Size

5.07 kB

Total Files

4

Last publish

Collaborators

  • kikobeats