logitar-validation
Version:
JavaScript validation library distributed by Logitar.
17 lines (16 loc) • 657 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* A validation rule that checks if a value is equal to another value.
* @param value The value to validate.
* @param args The value to compare the value to.
* @returns The result of the validation rule execution.
*/
const confirm = (value, args) => {
const isValid = typeof value === "object" || typeof args === "object" ? JSON.stringify(value) === JSON.stringify(args) : value === args;
if (!isValid) {
return { severity: "error", message: "{{name}} must equal {{confirm}}." };
}
return { severity: "information" };
};
exports.default = confirm;