(that: BigDecimal): (self: BigDecimal) => boolean
(self: BigDecimal, that: BigDecimal): booleanChecks whether a given BigDecimal is greater than or equal to the provided one.
When to use
Use to test whether one BigDecimal is greater than or equal to another.
Example (Checking greater-than-or-equal comparisons)
import { BigDecimal } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(
BigDecimal.isGreaterThanOrEqualTo(BigDecimal.fromStringUnsafe("2"), BigDecimal.fromStringUnsafe("3")),
false
)
assert.deepStrictEqual(
BigDecimal.isGreaterThanOrEqualTo(BigDecimal.fromStringUnsafe("3"), BigDecimal.fromStringUnsafe("3")),
true
)
assert.deepStrictEqual(
BigDecimal.isGreaterThanOrEqualTo(BigDecimal.fromStringUnsafe("4"), BigDecimal.fromStringUnsafe("3")),
true
)export const const isGreaterThanOrEqualTo: {
(that: BigDecimal): (
self: BigDecimal
) => boolean
(self: BigDecimal, that: BigDecimal): boolean
}
Checks whether a given BigDecimal is greater than or equal to the provided one.
When to use
Use to test whether one BigDecimal is greater than or equal to another.
Example (Checking greater-than-or-equal comparisons)
import { BigDecimal } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(
BigDecimal.isGreaterThanOrEqualTo(BigDecimal.fromStringUnsafe("2"), BigDecimal.fromStringUnsafe("3")),
false
)
assert.deepStrictEqual(
BigDecimal.isGreaterThanOrEqualTo(BigDecimal.fromStringUnsafe("3"), BigDecimal.fromStringUnsafe("3")),
true
)
assert.deepStrictEqual(
BigDecimal.isGreaterThanOrEqualTo(BigDecimal.fromStringUnsafe("4"), BigDecimal.fromStringUnsafe("3")),
true
)
isGreaterThanOrEqualTo: {
(that: BigDecimal(parameter) that: {
value: bigint;
scale: number;
normalized: BigDecimal;
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: BigDecimal): (self: BigDecimal(parameter) self: {
value: bigint;
scale: number;
normalized: BigDecimal;
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: BigDecimal) => boolean
(self: BigDecimal(parameter) self: {
value: bigint;
scale: number;
normalized: BigDecimal;
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: BigDecimal, that: BigDecimal(parameter) that: {
value: bigint;
scale: number;
normalized: BigDecimal;
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: BigDecimal): boolean
} = import orderorder.const isGreaterThanOrEqualTo: <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
isGreaterThanOrEqualTo(const Order: order.Order<BigDecimal>Provides an Order instance for BigDecimal that allows comparing and sorting BigDecimal values.
When to use
Use when you need to sort or compare decimal values through APIs that accept
an ordering instance.
Example (Comparing decimals)
import { BigDecimal } from "effect"
const a = BigDecimal.fromNumberUnsafe(1.5)
const b = BigDecimal.fromNumberUnsafe(2.3)
const c = BigDecimal.fromNumberUnsafe(1.5)
console.log(BigDecimal.Order(a, b)) // -1 (a < b)
console.log(BigDecimal.Order(b, a)) // 1 (b > a)
console.log(BigDecimal.Order(a, c)) // 0 (a === c)
Order)