<commit_before>/*!
 * Laravel Javascript Validation
 *
 * https://github.com/proengsoft/laravel-jsvalidation
 *
 * Helper functions used by validators
 *
 * Copyright (c) 2014 Proengsoft
 * Released under the MIT license
 */

$.extend(true, laravelValidation, {

    helpers: {

        /**
         * Gets the file information from file input
         *
         * @param fieldObj
         * @returns {{file: *, extension: string, size: number}}
         */
        fileinfo: function (fieldObj) {
            var FileName = fieldObj.value;
            return {
                file: FileName,
                extension: FileName.substr(FileName.lastIndexOf('.') + 1),
                size: fieldObj.files[0].size / 1024
            };
        },


        /**
         *
         * Gets the selectors for th specified field names
         *
         * @param names
         * @returns {string}
         */
        selector: function (names) {
            var selector = [];
            if (!$.isArray(names))  {
                names = [names];
            }
            for (var i = 0; i < names.length; i++) {
                selector.push("[name='" + names[i] + "']");
            }
            return selector.join();
        },


        /**
         * Check if element has numeric rules
         *
         * @param element
         * @returns {boolean}
         */
        hasNumericRules: function (element) {

            var numericRules = ['Numeric', 'Integer'];
            var found = false;

            var validator = $.data(element.form, "validator");
            var objRules = validator.settings.rules[element.name];

            for (var i = 0; i < numericRules.length; i++) {
                found = found ||
                    $.grep(objRules, function(rule) {
                        return $.inArray(numericRules[i], rule);
                    });
            }

            return found;
        },


        /**
         * Return the string length using PHP function
         * http://php.net/manual/en/function.strlen.php
         * http://phpjs.org/functions/strlen/
         *
         * @param string
         */
        strlen: function (string) {
            return strlen(string);
        },


        /**
         * Get the size of the object depending of his type
         *
         * @param obj
         * @param element
         * @param value
         * @returns int
         */<commit_msg>size always is validate like number<commit_after>/*!
 * Laravel Javascript Validation
 *
 * https://github.com/proengsoft/laravel-jsvalidation
 *
 * Helper functions used by validators
 *
 * Copyright (c) 2014 Proengsoft
 * Released under the MIT license
 */

$.extend(true, laravelValidation, {

    helpers: {

        /**
         * Gets the file information from file input
         *
         * @param fieldObj
         * @returns {{file: *, extension: string, size: number}}
         */
        fileinfo: function (fieldObj) {
            var FileName = fieldObj.value;
            return {
                file: FileName,
                extension: FileName.substr(FileName.lastIndexOf('.') + 1),
                size: fieldObj.files[0].size / 1024
            };
        },


        /**
         *
         * Gets the selectors for th specified field names
         *
         * @param names
         * @returns {string}
         */
        selector: function (names) {
            var selector = [];
            if (!$.isArray(names))  {
                names = [names];
            }
            for (var i = 0; i < names.length; i++) {
                selector.push("[name='" + names[i] + "']");
            }
            return selector.join();
        },


        /**
         * Check if element has numeric rules
         *
         * @param element
         * @returns {boolean}
         */
        hasNumericRules: function (element) {

            var numericRules = ['Numeric', 'Integer'];
            var found = false;

            var validator = $.data(element.form, "validator");
            var objRules = validator.settings.rules[element.name];
            if ('laravelValidation' in objRules) {
                var rules=objRules.laravelValidation;
                for (var i = 0; i < rules.length; i++) {
                    if ($.inArray(rules[i][0],numericRules) !== -1) {
                        found = true;
                        break;
                    }
                }
            }

            return found;
        },


        /**
         * Return the string length using PHP function
         * http://php.net/manual/en/function.strlen.php
         * http://phpjs.org/functions/strlen/
         *
         * @param string
         */
        strlen: function (string) {
            return strlen(string);
        },


        /**
         * Get the size of the object depending of his type
         *
         * @param obj
         * @param element
         * @param value
         * @returns int
         */
{'fraction_non_alphanumeric': 0.11623246492985972, 'fraction_numerical': 0.0052104208416833666, 'mean_word_length': 1.2947126436781609, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '4097845', 'n_tokens_mistral': 1334, 'n_tokens_neox': 1262, 'n_words': 332}