Schema - Min (BigInt)
The .min
method is used to validate whether a given BigInt
value meets a specified minimum threshold. It ensures that the input value is greater than or equal to the defined BigInt
minimum, providing a robust way to enforce lower bounds for large integer data.
This method is particularly useful for scenarios requiring strict lower limits on large integers, such as cryptographic operations, financial computations, or precise data modeling.
Example
Below is an example of how to use .min
to validate whether a BigInt
value meets the minimum required value:
import { schema } from "vkrun"
const exampleSchema = schema().bigInt().min(2n)
const validateA = exampleSchema.validate(2n) // Valid, meets the minimum threshold
const validateB = exampleSchema.validate(1n) // Invalid, below the minimum threshold
console.log(validateA) // true
console.log(validateB) // false