(self: Duration): booleanReturns true if the duration is negative (strictly less than zero).
Example (Checking for negative durations)
import { Duration } from "effect"
console.log(Duration.isNegative(Duration.seconds(-5))) // true
console.log(Duration.isNegative(Duration.zero)) // false
console.log(Duration.isNegative(Duration.negativeInfinity)) // trueguards
Source effect/Duration.ts:47612 lines
export const const isNegative: (
self: Duration
) => boolean
Returns true if the duration is negative (strictly less than zero).
Example (Checking for negative durations)
import { Duration } from "effect"
console.log(Duration.isNegative(Duration.seconds(-5))) // true
console.log(Duration.isNegative(Duration.zero)) // false
console.log(Duration.isNegative(Duration.negativeInfinity)) // true
isNegative = (self: Duration(parameter) self: {
value: DurationValue;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
self: Duration): boolean => {
switch (self: Duration(parameter) self: {
value: DurationValue;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
self.Duration.value: DurationValuevalue._tag: | "Millis"
| "Nanos"
| "Infinity"
| "NegativeInfinity"
_tag) {
case "Millis":
return self: Duration(parameter) self: {
value: DurationValue;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
self.Duration.value: DurationValuevalue.millis: numbermillis < 0
case "Nanos":
return self: Duration(parameter) self: {
value: DurationValue;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
self.Duration.value: DurationValuevalue.nanos: bigintnanos < const bigint0: bigintbigint0
case "NegativeInfinity":
return true
case "Infinity":
return false
}
}Referenced by 1 symbols