@cowwoc/requirements
Version:
A fluent API for enforcing design contracts with automatic message generation.
105 lines • 3.53 kB
JavaScript
import { AbstractValidator, messagesConstraint, comparableCompareValues } from "../internal.mjs";
/**
* @param validator - the validator
* @returns a message for the validation failure
*/
function numberIsNegative(validator) {
return messagesConstraint(validator, "must be negative");
}
/**
* @param validator - the validator
* @returns a message for the validation failure
*/
function numberIsNotNegative(validator) {
return messagesConstraint(validator, "may not be negative");
}
/**
* @param validator - the validator
* @returns a message for the validation failure
*/
function numberIsZero(validator) {
return messagesConstraint(validator, "must be zero");
}
/**
* @param validator - the validator
* @returns a message for the validation failure
*/
function numberIsNotZero(validator) {
return messagesConstraint(validator, "may not be zero");
}
/**
* @param validator - the validator
* @returns a message for the validation failure
*/
function numberIsPositive(validator) {
return messagesConstraint(validator, "must be positive");
}
/**
* @param validator - the validator
* @returns a message for the validation failure
*/
function numberIsNotPositive(validator) {
return messagesConstraint(validator, "may not be positive");
}
/**
* @param validator - the validator
* @param factorName - the name of the factor
* @param factor - the value being multiplied by
* @returns a message for the validation failure
*/
function numberIsMultipleOf(validator, factorName, factor) {
return comparableCompareValues(validator, "must be a multiple of", factorName, factor);
}
/**
* @param validator - the validator
* @param factorName - the name of the factor
* @param factor - the value being multiplied by
* @returns a message for the validation failure
*/
function numberIsNotMultipleOf(validator, factorName, factor) {
return comparableCompareValues(validator, "may not be a multiple of", factorName, factor);
}
/**
* @param validator - the validator
* @returns a message for the validation failure
*/
function numberIsWholeNumber(validator) {
return messagesConstraint(validator, "must be a whole number");
}
/**
* @param validator - the validator
* @returns a message for the validation failure
*/
function numberIsNotWholeNumber(validator) {
return messagesConstraint(validator, "may not be a whole number");
}
/**
* @param validator - the validator
* @returns a message for the validation failure
*/
function numberIsNumber(validator) {
return messagesConstraint(validator, "must be a well-defined number");
}
/**
* @param validator - the validator
* @returns a message for the validation failure
*/
function numberIsNotNumber(validator) {
return messagesConstraint(validator, "may not be a well-defined number");
}
/**
* @param validator - the validator
* @returns a message for the validation failure
*/
function numberIsFinite(validator) {
return messagesConstraint(validator, "must be a finite number");
}
/**
* @param validator - the validator
* @returns a message for the validation failure
*/
function numberIsInfinite(validator) {
return messagesConstraint(validator, "must be an infinite number");
}
export { numberIsNegative, numberIsNotNegative, numberIsZero, numberIsNotZero, numberIsPositive, numberIsNotPositive, numberIsMultipleOf, numberIsNotMultipleOf, numberIsWholeNumber, numberIsNotWholeNumber, numberIsNumber, numberIsNotNumber, numberIsFinite, numberIsInfinite };
//# sourceMappingURL=NumberMessages.mjs.map