typed-duration
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "typed-duration", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Zero-dependency typed duration library for JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -55,6 +55,5 @@ # Typed Duration | ||
import { Duration, TimeDuration } from 'typed-duration' | ||
const { milliseconds } = Duration | ||
function executePeriodically(fn: () => void, period: TimeDuration) { | ||
setTimeout(fn, milliseconds.from(period)) | ||
setTimeout(fn, Duration.milliseconds.from(period)) | ||
} | ||
@@ -93,10 +92,9 @@ ``` | ||
import { Duration, MaybeTimeDuration } from 'typed-duration' | ||
const { milliseconds } = Duration | ||
function executePeriodically(fn: () => void, period: MaybeTimeDuration) { | ||
setTimeout(fn, milliseconds.from(period)) | ||
setTimeout(fn, Duration.milliseconds.from(period)) | ||
} | ||
// You can pass in a typed duration, and it will convert to a number of milliseconds | ||
executePeriodically(doSomething, seconds.from(20)) | ||
executePeriodically(doSomething, Duration.seconds.from(20)) | ||
@@ -103,0 +101,0 @@ // a number will be allowed by the MaybeTimeDuration type |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13204
106