Socket
Socket
Sign inDemoInstall

@kikobeats/time-span

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @kikobeats/time-span

simple high resolution timing


Version published
Weekly downloads
2.8K
decreased by-12.32%
Maintainers
1
Install size
4.95 kB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 08 May 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc