(that: Duration): (self: Duration) => boolean
(self: Duration, that: Duration): booleanChecks whether the first Duration is greater than the second.
Example (Comparing durations with greater than)
import { Duration } from "effect"
const isGreater = Duration.isGreaterThan(Duration.seconds(5), Duration.seconds(3))
console.log(isGreater) // truepredicates
Source effect/Duration.ts:15744 lines
export const const isGreaterThan: {
(that: Duration): (self: Duration) => boolean
(self: Duration, that: Duration): boolean
}
Checks whether the first Duration is greater than the second.
Example (Comparing durations with greater than)
import { Duration } from "effect"
const isGreater = Duration.isGreaterThan(Duration.seconds(5), Duration.seconds(3))
console.log(isGreater) // true
isGreaterThan: {
(that: Duration(parameter) that: {
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;
}
that: Duration): (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
(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, that: Duration(parameter) that: {
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;
}
that: Duration): boolean
} = import orderorder.const isGreaterThan: <A>(O: Order<A>) => {
(that: A): (self: A) => boolean
(self: A, that: A): boolean
}
Checks whether one value is strictly greater than another according to the given order.
When to use
Use when you need a boolean greater-than predicate using an Order.
Details
Returns true if the order returns 1, meaning the first value is greater
than the second. Equal or lesser values return false.
Example (Checking greater-than comparisons)
import { Order } from "effect"
const isGreaterThanNumber = Order.isGreaterThan(Order.Number)
console.log(isGreaterThanNumber(2, 1)) // true
console.log(isGreaterThanNumber(1, 2)) // false
console.log(isGreaterThanNumber(1, 1)) // false
isGreaterThan(const Order: order.Order<Duration>Provides an Order instance for comparing Duration values.
Details
NegativeInfinity < any finite value < Infinity.
Example (Sorting durations)
import { Duration } from "effect"
const durations = [
Duration.seconds(3),
Duration.seconds(1),
Duration.seconds(2)
]
const sorted = durations.sort((a, b) => Duration.Order(a, b))
console.log(sorted.map(Duration.toSeconds)) // [1, 2, 3]
Order)