UNPKG

composite-validation

Version:
17 lines 731 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var utils_1 = require("../utils"); var composite_validation_options_1 = require("./composite-validation-options"); function max(val, target, condition, error) { if (condition === void 0) { condition = null; } if (error === void 0) { error = null; } if (condition && !condition()) { return utils_1.Utils.getWrappedValue(val); } if (+val > target) { return utils_1.Utils.getErrorObject(!!error ? error : composite_validation_options_1.CompositeValidationOptions.errorMatch('max'), false, [target]); } return utils_1.Utils.getWrappedValue(val); } exports.max = max; //# sourceMappingURL=max.js.map