(that: bigint): (self: bigint) => bigint
(self: bigint, that: bigint): bigintReturns the maximum between two bigints.
When to use
Use to select the larger of two bigint values.
Example (Finding the maximum bigint)
import { BigInt } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(BigInt.max(2n, 3n), 3n)export const const max: {
(that: bigint): (self: bigint) => bigint
(self: bigint, that: bigint): bigint
}
Returns the maximum between two bigints.
When to use
Use to select the larger of two bigint values.
Example (Finding the maximum bigint)
import { BigInt } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(BigInt.max(2n, 3n), 3n)
max: {
(that: bigintthat: bigint): (self: bigintself: bigint) => bigint
(self: bigintself: bigint, that: bigintthat: bigint): bigint
} = import orderorder.const max: <A>(O: Order<A>) => {
(that: A): (self: A) => A
(self: A, that: A): A
}
Returns the maximum of two values according to the given order. If they are equal, returns the first argument.
When to use
Use when you need to select the larger of two values according to an
Order.
Details
Returns the value that compares as greater than or equal to the other value.
If values are equal, the first argument is returned.
Example (Selecting the maximum value)
import { Order } from "effect"
const maxNumber = Order.max(Order.Number)
console.log(maxNumber(1, 2)) // 2
console.log(maxNumber(2, 1)) // 2
console.log(maxNumber(1, 1)) // 1
max(const Order: order.Order<bigint>Provides an Order instance for bigint that allows comparing and sorting BigInt values.
When to use
Use when you need to sort or compare bigint values through APIs that accept
an ordering instance.
Example (Comparing bigints with Order)
import { BigInt } from "effect"
const a = 123n
const b = 456n
const c = 123n
console.log(BigInt.Order(a, b)) // -1 (a < b)
console.log(BigInt.Order(b, a)) // 1 (b > a)
console.log(BigInt.Order(a, c)) // 0 (a === c)
Order)