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

Function abs

packages/effect/src/Duration.ts:623–633  ·  view source on GitHub ↗
(self: Duration)

Source from the content-addressed store, hash-verified

621 * @since 4.0.0
622 */
623export const abs = (self: Duration): Duration => {
624 switch (self.value._tag) {
625 case "Infinity":
626 case "NegativeInfinity":
627 return infinity
628 case "Millis":
629 return self.value.millis < 0 ? make(-self.value.millis) : self
630 case "Nanos":
631 return self.value.nanos < bigint0 ? make(-self.value.nanos) : self
632 }
633}
634
635/**
636 * Returns the negated duration.

Callers 1

formatFunction · 0.70

Calls 1

makeFunction · 0.70

Tested by

no test coverage detected