<commit_before>(function (exports) {
    'use strict';

    /**
     * Gets the type of the value in lower case.
     *
     * @param {*} value The value to test.
     * @returns {string}
     */
    function getType (value) {
        // inspired by http://techblog.badoo.com/blog/2013/11/01/type-checking-in-javascript/

        // handle null in old IE
        if (value === null) {
            return 'null';
        }

        // handle DOM elements
        if (value && (value.nodeType === 1 || value.nodeType === 9)) {
            return 'element';
        }

        var s = Object.prototype.toString.call(value);
        var type = s.match(/\[object (.*?)\]/)[1].toLowerCase();

        // handle NaN and Infinity
        if (type === 'number') {
            if (isNaN(value)) {
                return 'nan';
            }
            if (!isFinite(value)) {
                return 'infinity';
            }
        }

        return type;
    }

    //
    // ### function validate (object, schema, options)
    // #### {Object} object the object to validate.
    // #### {Object} schema (optional) the JSON Schema to validate against.
    // #### {Object} options (optional) options controlling the validation
    //      process. See {@link #validate.defaults) for details.
    // Validate <code>object</code> against a JSON Schema.
    // If <code>object</code> is self-describing (i.e. has a
    // <code>$schema</code> property), it will also be validated
    // against the referenced schema. [TODO]: This behaviour bay be
    // suppressed by setting the {@link #validate.options.???}
    // option to <code>???</code>.[/TODO]
    //
    // If <code>schema</code> is not specified, and <code>object</code>
    // is not self-describing, validation always passes.
    //
    // <strong>Note:</strong> in order to pass options but no schema,
    // <code>schema</code> <em>must</em> be specified in the call to
    // <code>validate()</code>; otherwise, <code>options</code> will
    // be interpreted as the schema. <code>schema</code> may be passed
    // as <code>null</code>, <code>undefinded</code>, or the empty object
    // (<code>{}</code>) in this case.
    //
    function validate (object, schema, options) {
        options = mixin({}, validate.defaults, options);

        if (options.hasOwnProperty('deleteUnknownProperties')) {
            console.log('lx-valid: option "deleteUnknownProperties" is deprcated. It will be removed in version 0.5.0! Please use option "unknowProperties" instead.');
        }

        if (options.trim === true) {
            // ensure that trim works in old browsers
            if (!String.prototype.trim) {
                String.prototype.trim = function () {
                    return this.replace(/^\s+|\s+$/g, '');
                };
            }
        }

        var errors = [];

        //// handle array root element
        if (schema.items) {
            validateProperty(object, object, '', schema, options, errors);
        } else {
            validateObject(object, schema, options, errors);
        }

        return {
            valid: !(errors.length),
            errors: errors
        };
    }

    /**
     * Default validation options. Defaults can be overridden by
     * passing an 'options' hash to {@link #validate}. They can
     * also be set globally be changing the values in
     * <code>validate.defaults</code> directly.
     */
    validate.defaults = {
        /**
         * <p>
         * Enforce 'format' constraints.
         * </p><p>
         * <em>Default: <code>true</code></em>
         * </p>
         */
        validateFormats: true,
        /**
         * <p>
         * When {@link #validateFormats} is <code>true</code>,
         * treat unrecognized formats as validation errors.
         * </p><p>
         * <em>Default: <code>false</code></em>
         * </p>
         *
         * @see validation.formats for default supported formats.
         */
        validateFormatsStrict: false,
        /**
         * <p>
         * When {@link #validateFormats} is <code>true</code>,
         * also validate formats defined in {@link validate.formatExtensions}.
         * </p><p>
         * <em>Default: <code>true</code></em>
         * </p>
         */
        validateFormatExtensions: true,
        /**
         * <p>
         * When {@link #addMissingDefaults} is <code>true</code>,
         * if property is missing and it has a default value it will be added to the object.
         * </p><p>
         * <em>Default: <code>false</code></em>
         * </p>
         */
        addMissingDefaults: false,
        /**
         * <p>
         * When {@link #deleteUnknownProperties} is <code>true</code>,
         * if property is not declared in schema it is deleted from object.
         * </p><p>
         * <em>Default: <code>false</code></em>
         * </p>
         */
        deleteUnknownProperties: false,
        /**
         * <p>
         * When {@link #unknownProperties} is set to <code>'delete'</code>,
         * if property is not declared in schema it is deleted from object.
         * When set to <code>'error'</code>, the property will not be deleted and an error is created.
         * When set to <code>'ignore'</code>, the property will not be deleted.
         * </p><p>
         * <em>Default: <code>ignore</code></em>
         * </p>
         */
        unknownProperties: 'ignore',
        /**
         * <p>
         * When {@link #trim} is <code>true</code>,
         * all string values are trimmed.
         * </p><p>
         * <em>Default: <code>false</code></em>
         * </p>
         */
        trim: false,
        /**
         * <p>
         * When {@link #strictRequired} is <code>true</code>,
         * all empty string values ('') which are required will be invalid.
         * </p><p>
         * <em>Default: <code>false</code></em>
         * </p>
         */
        strictRequired: false,
        /**<commit_msg>fix: remove option "deleteUnknownProperties" from default options<commit_after>(function (exports) {
    'use strict';

    /**
     * Gets the type of the value in lower case.
     *
     * @param {*} value The value to test.
     * @returns {string}
     */
    function getType (value) {
        // inspired by http://techblog.badoo.com/blog/2013/11/01/type-checking-in-javascript/

        // handle null in old IE
        if (value === null) {
            return 'null';
        }

        // handle DOM elements
        if (value && (value.nodeType === 1 || value.nodeType === 9)) {
            return 'element';
        }

        var s = Object.prototype.toString.call(value);
        var type = s.match(/\[object (.*?)\]/)[1].toLowerCase();

        // handle NaN and Infinity
        if (type === 'number') {
            if (isNaN(value)) {
                return 'nan';
            }
            if (!isFinite(value)) {
                return 'infinity';
            }
        }

        return type;
    }

    //
    // ### function validate (object, schema, options)
    // #### {Object} object the object to validate.
    // #### {Object} schema (optional) the JSON Schema to validate against.
    // #### {Object} options (optional) options controlling the validation
    //      process. See {@link #validate.defaults) for details.
    // Validate <code>object</code> against a JSON Schema.
    // If <code>object</code> is self-describing (i.e. has a
    // <code>$schema</code> property), it will also be validated
    // against the referenced schema. [TODO]: This behaviour bay be
    // suppressed by setting the {@link #validate.options.???}
    // option to <code>???</code>.[/TODO]
    //
    // If <code>schema</code> is not specified, and <code>object</code>
    // is not self-describing, validation always passes.
    //
    // <strong>Note:</strong> in order to pass options but no schema,
    // <code>schema</code> <em>must</em> be specified in the call to
    // <code>validate()</code>; otherwise, <code>options</code> will
    // be interpreted as the schema. <code>schema</code> may be passed
    // as <code>null</code>, <code>undefinded</code>, or the empty object
    // (<code>{}</code>) in this case.
    //
    function validate (object, schema, options) {
        options = mixin({}, validate.defaults, options);

        if (options.hasOwnProperty('deleteUnknownProperties')) {
            console.log('lx-valid: option "deleteUnknownProperties" is deprcated. It will be removed in version 0.5.0! Please use option "unknowProperties" instead.');
        }

        if (options.trim === true) {
            // ensure that trim works in old browsers
            if (!String.prototype.trim) {
                String.prototype.trim = function () {
                    return this.replace(/^\s+|\s+$/g, '');
                };
            }
        }

        var errors = [];

        //// handle array root element
        if (schema.items) {
            validateProperty(object, object, '', schema, options, errors);
        } else {
            validateObject(object, schema, options, errors);
        }

        return {
            valid: !(errors.length),
            errors: errors
        };
    }

    /**
     * Default validation options. Defaults can be overridden by
     * passing an 'options' hash to {@link #validate}. They can
     * also be set globally be changing the values in
     * <code>validate.defaults</code> directly.
     */
    validate.defaults = {
        /**
         * <p>
         * Enforce 'format' constraints.
         * </p><p>
         * <em>Default: <code>true</code></em>
         * </p>
         */
        validateFormats: true,
        /**
         * <p>
         * When {@link #validateFormats} is <code>true</code>,
         * treat unrecognized formats as validation errors.
         * </p><p>
         * <em>Default: <code>false</code></em>
         * </p>
         *
         * @see validation.formats for default supported formats.
         */
        validateFormatsStrict: false,
        /**
         * <p>
         * When {@link #validateFormats} is <code>true</code>,
         * also validate formats defined in {@link validate.formatExtensions}.
         * </p><p>
         * <em>Default: <code>true</code></em>
         * </p>
         */
        validateFormatExtensions: true,
        /**
         * <p>
         * When {@link #addMissingDefaults} is <code>true</code>,
         * if property is missing and it has a default value it will be added to the object.
         * </p><p>
         * <em>Default: <code>false</code></em>
         * </p>
         */
        addMissingDefaults: false,
        /**
         * <p>
         * When {@link #unknownProperties} is set to <code>'delete'</code>,
         * if property is not declared in schema it is deleted from object.
         * When set to <code>'error'</code>, the property will not be deleted and an error is created.
         * When set to <code>'ignore'</code>, the property will not be deleted.
         * </p><p>
         * <em>Default: <code>ignore</code></em>
         * </p>
         */
        unknownProperties: 'ignore',
        /**
         * <p>
         * When {@link #trim} is <code>true</code>,
         * all string values are trimmed.
         * </p><p>
         * <em>Default: <code>false</code></em>
         * </p>
         */
        trim: false,
        /**
         * <p>
         * When {@link #strictRequired} is <code>true</code>,
         * all empty string values ('') which are required will be invalid.
         * </p><p>
         * <em>Default: <code>false</code></em>
         * </p>
         */
        strictRequired: false,
        /**
{'fraction_non_alphanumeric': 0.14809121188829105, 'fraction_numerical': 0.0023913229139977794, 'mean_word_length': 1.7539981185324554, 'pattern_counts': {'":': 0, '<': 221, '<?xml version=': 0, '>': 221, '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': '2836394', 'n_tokens_mistral': 3324, 'n_tokens_neox': 3241, 'n_words': 960}