/**
 * DevExtreme (cjs/__internal/scheduler/options_validator/core/validator.js)
 * Version: 23.2.6 (build 24140-0112)
 * Build date: Sun May 19 2024
 *
 * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.Validator = void 0;
let Validator = function() {
    function Validator(valueSelector, rules) {
        this.valueSelector = valueSelector;
        this.rules = rules
    }
    var _proto = Validator.prototype;
    _proto.validate = function(options) {
        const value = this.valueSelector(options);
        const errors = this.rules.reduce((result, rule) => {
            const validationResult = rule(value);
            if (true !== validationResult) {
                result[rule.name] = validationResult
            }
            return result
        }, {});
        return Object.keys(errors).length ? errors : true
    };
    return Validator
}();
exports.Validator = Validator;
