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

Class Duration

packages/effect/src/Schema.ts:6012–6042  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6010 * @since 3.10.0
6011 */
6012export class Duration extends transform(
6013 Union(DurationValue, HRTime),
6014 DurationFromSelf,
6015 {
6016 strict: true,
6017 decode: (i) => {
6018 if (isDurationValue(i)) {
6019 switch (i._tag) {
6020 case "Millis":
6021 return duration_.millis(i.millis)
6022 case "Nanos":
6023 return duration_.nanos(i.nanos)
6024 case "Infinity":
6025 return duration_.infinity
6026 }
6027 }
6028 const [seconds, nanos] = i
6029 return seconds === -1 ? duration_.infinity : duration_.nanos(BigInt(seconds) * BigInt(1e9) + BigInt(nanos))
6030 },
6031 encode: (a) => {
6032 switch (a.value._tag) {
6033 case "Millis":
6034 return DurationValueMillis.make({ millis: a.value.millis })
6035 case "Nanos":
6036 return DurationValueNanos.make({ nanos: a.value.nanos })
6037 case "Infinity":
6038 return durationValueInfinity
6039 }
6040 }
6041 }
6042).annotations({ identifier: "Duration" }) {}
6043
6044/**
6045 * Clamps a `Duration` between a minimum and a maximum value.

Callers

nothing calls this directly

Calls 5

isDurationValueFunction · 0.85
transformInterface · 0.70
UnionFunction · 0.70
annotationsMethod · 0.65
makeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…