devextreme
Version:
HTML5 JavaScript Component Suite for Responsive Web Development
30 lines (29 loc) • 1.7 kB
JavaScript
/**
* DevExtreme (esm/__internal/scheduler/options_validator/common/validator_rules.js)
* Version: 23.2.6
* Build date: Wed May 01 2024
*
* Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
import {
createValidatorRule
} from "../core/index";
import {
divisibleBy,
greaterThan,
inRange,
isInteger,
lessThan
} from "./validation_functions";
export var mustBeInteger = createValidatorRule("mustBeInteger", value => isInteger(value) || "".concat(value, " must be an integer."));
export var mustBeGreaterThan = function(minimalValue) {
var strict = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : true;
return createValidatorRule("mustBeGreaterThan", value => greaterThan(value, minimalValue, strict) || "".concat(value, " must be ").concat(strict ? ">" : ">=", " than ").concat(minimalValue, "."))
};
export var mustBeLessThan = function(maximalValue) {
var strict = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : true;
return createValidatorRule("mustBeLessThan", value => lessThan(value, maximalValue, strict) || "".concat(value, " must be ").concat(strict ? "<" : "<=", " than ").concat(maximalValue, "."))
};
export var mustBeInRange = range => createValidatorRule("mustBeInRange", value => inRange(value, range) || "".concat(value, " must be in range [").concat(range[0], ", ").concat(range[1], "]."));
export var mustBeDivisibleBy = divider => createValidatorRule("mustBeDivisibleBy", value => divisibleBy(value, divider) || "".concat(value, " must be divisible by ").concat(divider, "."));