Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

typed-duration

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typed-duration - npm Package Compare versions

Comparing version 1.0.7 to 1.0.8

2

package.json
{
"name": "typed-duration",
"version": "1.0.7",
"version": "1.0.8",
"description": "Zero-dependency typed duration library for JavaScript",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -104,4 +104,26 @@ # Typed Duration

## Logging
You can log times for user information in the format that the user specified them, including units, with `Duration.value.of`. For example:
```TypeScript
import { Duration, MaybeTimeDuration } from 'typed-duration'
function executePeriodically(fn: () => void, period: MaybeTimeDuration) {
console.log(`Executing in ${Duration.value.of(period)}...`)
setTimeout(fn, Duration.milliseconds.from(period))
}
executePeriodically(doSomething, Duration.seconds.from(20))
// Executing in 20s...
executePeriodically(doSomething, Duration.milliseconds.from(350))
// Executing in 350ms...
executePeriodically(doSomething, 2500)
// Executing in 2500...
```
## Feature Requests, Bug Reports
See the [GitHub repo](https://github.com/jwulf/typed-duration).
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc