src/validator.js
function Validator(type, config)
    {
        this.type           = type;
        this.message        = undefined;
        this.value          = undefined;
        this.groups         = undefined;
        this.fieldValidator = undefined;
        this.parent         = undefined;

        if (typeof(config) === 'object') {
            this.groups = config.groups;

            if (_.has(config, 'message'))
                this.message = config.message;

            if (_.has(config, 'value') && !_.isUndefined(config.value))
                this.value = config.value;

        } else if (!_.isUndefined(config)) {
            this.value = config;
        }

        return this;
    }
function Validator(type, config)
    {
        this.type           = type;
        this.message        = undefined;
        this.value          = undefined;
        this.groups         = undefined;
        this.fieldValidator = undefined;
        this.parent         = undefined;

        if (typeof(config) === 'object') {
            this.groups = config.groups;

            if (_.has(config, 'message'))
                this.message = config.message;

            if (_.has(config, 'value') && !_.isUndefined(config.value))
                this.value = config.value;

        } else if (!_.isUndefined(config)) {
            this.value = config;
        }

        return this;
    }
function Validator ( type , config ) { this . type = type ; this . message = undefined ; this . value = undefined ; this . groups = undefined ; this . fieldValidator = undefined ; this . parent = undefined ; if ( typeof ( config ) === 'object' ) { this . groups = config . groups ; if ( _ . has ( config , 'message' ) ) this . message = config . message ; if ( _ . has ( config , 'value' ) && ! _ . isUndefined ( config . value ) ) this . value = config . value ; } else if ( ! _ . isUndefined ( config ) ) { this . value = config ; } return this ; }
Validator object validate a data based on a configured rule. It raise an error or reject a promise
@param string type   The validator type (must be present in the rules objects)
@param object config The validator type configuration
Validator object validate a data based on a configured rule . It raise an error or reject a promise