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

Function abs

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

Source from the content-addressed store, hash-verified

555 * @since 4.0.0
556 */
557export const abs = (self: Duration): Duration => {
558 switch (self.value._tag) {
559 case "Infinity":
560 case "NegativeInfinity":
561 return infinity
562 case "Millis":
563 return self.value.millis < 0 ? make(-self.value.millis) : self
564 case "Nanos":
565 return self.value.nanos < bigint0 ? make(-self.value.nanos) : self
566 }
567}
568
569/**
570 * Returns the negated duration.

Callers 1

formatFunction · 0.70

Calls 1

makeFunction · 0.70

Tested by

no test coverage detected