time-span
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())
It also accepts a format
function:
const duration = timeSpan({ format: n => `${Math.round(n)}ms`})
await setTimeout(5000)
console.log(duration())
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