docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
Build a data validation module that compares numerical values with configurable thresholds and rules. The module should handle various data types and provide detailed comparison results.
Implement a module that validates numerical data against threshold configurations. The validator should:
The module should validate values against threshold rules. Each rule specifies:
The validator should return whether the value satisfies the rule.
The module should check if two values are exactly equal, including for high-precision decimal numbers and fractions.
The module should compare two values and return their relative ordering (-1 if first is smaller, 0 if equal, 1 if first is larger).
/**
* Validates if a value satisfies a threshold rule
* @param {number|string} value - The value to validate
* @param {string} operator - Comparison operator: 'equal', 'unequal', 'greater', 'less', 'greaterOrEqual', 'lessOrEqual'
* @param {number|string} threshold - The threshold value
* @returns {boolean} True if validation passes, false otherwise
*/
export function validateThreshold(value, operator, threshold) {}
/**
* Checks if two values are exactly equal
* @param {number|string} value1 - First value
* @param {number|string} value2 - Second value
* @returns {boolean} True if values are exactly equal
*/
export function areEqual(value1, value2) {}
/**
* Compares two values and returns their ordering
* @param {number|string} value1 - First value
* @param {number|string} value2 - Second value
* @returns {number} -1 if value1 < value2, 0 if equal, 1 if value1 > value2
*/
export function compareValues(value1, value2) {}Provides mathematical operations and comparison functions for various numeric types.