<commit_before>import defaultValidator from './validators/defaultMetadataValidator';
import arrayValidator from './validators/arrayValidator';
import entityValidator from './validators/entityValidator';
import requiredValidator from './validators/requiredValidator';
import dateTimeValidator from './validators/dateTimeValidator';
import intValidator from './validators/intValidator';
import floatValidator from './validators/floatValidator';

var validator = {
    validators: [],
    /**
     * Evaluates the given metadata against the model
     * @param propertyMetadata - Can be either an object or an array of objects
     * @param model
     * @returns {{}}
     */
    validate(propertyMetadata, model) {
        if (!propertyMetadata) throw Error('Argument \'propertyMetadata\' should be truthy');
        if (!model) throw Error('\'model\' should be truthy');
        if (propertyMetadata.constructor !== Array) throw Error('ApropertyMetadata should be an array');

        let validationResult = {};
        propertyMetadata.forEach(m => {
            let propertyValidation;
            for(let i = 0; i < this.validators.length; i++) {
                let validate = this.validators[i];
                propertyValidation = validate(m, model[m.name], model, this);
                if(propertyValidation !== null && propertyValidation !== undefined) break;<commit_msg>Start to work on experimental branch for new features like wizard form and tab form.<commit_after>import defaultValidator from './validators/defaultMetadataValidator';
import arrayValidator from './validators/arrayValidator';
import entityValidator from './validators/entityValidator';
import requiredValidator from './validators/requiredValidator';
import dateTimeValidator from './validators/dateTimeValidator';
import intValidator from './validators/intValidator';
import floatValidator from './validators/floatValidator';

var validator = {
    validators: [],

    /**
     * Evaluates the given metadata against the model
     * @param propertyMetadata - Can be either an object or an array of objects
     * @param model
     * @returns {{}}
     */
    validate(propertyMetadata, model) {
        if (!propertyMetadata) throw Error('Argument \'propertyMetadata\' should be truthy');
        if (!model) throw Error('\'model\' should be truthy');
        if (propertyMetadata.constructor !== Array) throw Error('ApropertyMetadata should be an array');

        let validationResult = {};
        propertyMetadata.forEach(m => {
            let propertyValidation;
            for(let i = 0; i < this.validators.length; i++) {
                let validate = this.validators[i];
                propertyValidation = validate(m, model[m.name], model, this);
                if(propertyValidation !== null && propertyValidation !== undefined) break;
{'fraction_non_alphanumeric': 0.10911016949152542, 'fraction_numerical': 0.0007062146892655367, 'mean_word_length': 3.419656786271451, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7649265', 'n_tokens_mistral': 661, 'n_tokens_neox': 647, 'n_words': 219}