MCPcopy Index your code
hub / github.com/Effect-TS/effect / unsafeToNanos

Function unsafeToNanos

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

Source from the content-addressed store, hash-verified

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

Callers 1

partsFunction · 0.85

Calls 1

decodeFunction · 0.70

Tested by

no test coverage detected