Hyperlinkv0.8.0-beta.28

Order

Order.isGreaterThanOrEqualToconsteffect/Order.ts:765
<A>(O: Order<A>): {
  (that: A): (self: A) => boolean
  (self: A, that: A): boolean
}

Checks whether one value is greater than or equal to another according to the given order.

When to use

Use when you need a boolean greater-than-or-equal predicate using an Order.

Details

Returns true if the order returns 1 or 0, and returns false only if the order returns -1.

Example (Checking greater-than-or-equal comparisons)

import { Order } from "effect"

const isGreaterThanOrEqualToNumber = Order.isGreaterThanOrEqualTo(Order.Number)

console.log(isGreaterThanOrEqualToNumber(2, 1)) // true
console.log(isGreaterThanOrEqualToNumber(1, 1)) // true
console.log(isGreaterThanOrEqualToNumber(1, 2)) // false
Source effect/Order.ts:7654 lines
export const isGreaterThanOrEqualTo = <A>(O: Order<A>): {
  (that: A): (self: A) => boolean
  (self: A, that: A): boolean
} => dual(2, (self: A, that: A) => O(self, that) !== -1)
Referenced by 7 symbols