MCPcopy Create free account
hub / github.com/Effect-TS/effect / unsafeToNanos

Function unsafeToNanos

packages/effect/src/Duration.ts:385–395  ·  view source on GitHub ↗
(self: DurationInput)

Source from the content-addressed store, hash-verified

383 * @category getters
384 */
385export const unsafeToNanos = (self: DurationInput): bigint => {
386 const _self = decode(self)
387 switch (_self.value._tag) {
388 case "Infinity":
389 throw new Error("Cannot convert infinite duration to nanos")
390 case "Nanos":
391 return _self.value.nanos
392 case "Millis":
393 return BigInt(Math.round(_self.value.millis * 1_000_000))
394 }
395}
396
397/**
398 * @since 2.0.0

Callers 1

partsFunction · 0.85

Calls 1

decodeFunction · 0.70

Tested by

no test coverage detected