<commit_before>/*!
 * TextComplies jQuery Plugin
 *
 * Copyright (c) 2011, 2014 Availity, LLC
 * Licensed under the MIT license
 *
 * Author: <NAME>, <NAME>, <NAME>
 * Version: 1.1
 */
(function($) {
  "use strict";

  var methods = {
    init: function(options) {
      var settings = {
        minLength: -1,
        minLengthText: "Have at least # character%",
        maxLength: -1,
        maxLengthText: "Have no more than # character%",
        minAndMaxLengthText: "Have # to # character%",
        showNumbersAsWords: false,
        numNumbers: -1,
        numNumbersText: "Have at least # number%",
        numUppercaseLetters: -1,
        numUppercaseLettersText: "Have at least # uppercase letter%",
        numLowercaseLetters: -1,
        numLowercaseLettersText: "Have at least # lowercase letter%",
        numLetters: -1,
        numLettersText: "Have at least # letter%",
        disallowed: null,
        disallowedText: "Can't contain @",
        matchField: null,
        matchFieldText: "Match in both entry fields",
        matchPattern: null,
        matchPatternCaseSensitive: true,
        matchPatternText: "Must be in a valid format",
        disallowedPattern: null,
        disallowedPatternCaseSensitive: true,
        disallowedPatternText: "Must be in a valid format",
        validateOnStart: false,
        showAsFailOnStart: false,
        output: null,
        onComplies: null,
        onDefies: null
      };

      if (options) {
        $.extend(settings, options);
      }

      return this.each(function() {
        var numbers = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"];

        /**
         * Get a pointer to the field to check
         */
        var fieldForCompliance = $(this);

        /**
         * Test the text from the specified field for compliance with the configured options
         * @param text
         * @param options
         */
        function complies(text, options) {
          var results = {};
          results.minLength = options.minLength === -1 || (text.length >= options.minLength);
          results.maxLength = options.maxLength === -1 || (text.length <= options.maxLength);
          results.numNumbers = countComplies(options.numNumbers, text, /[0-9]/g);
          results.numLetters = countComplies(options.numLetters, text, /[a-zA-Z]/g);
          results.numUppercaseLetters = countComplies(options.numUppercaseLetters, text, /[A-Z]/g);
          results.numLowercaseLetters = countComplies(options.numLowercaseLetters, text, /[a-z]/g);
          results.disallowed = containsComplies(options.disallowed, text);
          results.matchField = options.matchField === null || text === $(options.matchField).val();
          results.matchPattern = patternComplies(options.matchPattern, options.matchPatternCaseSensitive, text);
          results.disallowedPattern = disallowedPatternComplies(options.disallowedPattern, options.disallowedPatternCaseSensitive, text);
          return results;
        }

        /**
         * Returns whether all of the properties on an object (but not its inherited properties)
         * are true
         * @param obj
         */
        function allRulesPass(obj) {
          for (var property in obj) {
            if (obj.hasOwnProperty(property) && !obj[property]) {
              return false;
            }
          }
          return true;
        }

        /**
         * Builds an item in the list
         * @param option
         * @param result
         * @param message
         */
        function buildItem(option, result, message) {
          var item = null;
          if (!(option === null || option === -1 || option.length === 0)) {
            var array = (option instanceof Array) ? option : [option];
            item = message;
            for (var index = 0; index < array.length; index++) {
              var num = (settings.showNumbersAsWords && array[index] < numbers.length) ? numbers[array[index]] : array[index];
              item = item.replace("#", num);
            }<commit_msg>Move numbers array to buildItem<commit_after>/*!
 * TextComplies jQuery Plugin
 *
 * Copyright (c) 2011, 2014 Availity, LLC
 * Licensed under the MIT license
 *
 * Author: <NAME>, <NAME>, <NAME>
 * Version: 1.1
 */
(function($) {
  "use strict";

  var methods = {
    init: function(options) {
      var settings = {
        minLength: -1,
        minLengthText: "Have at least # character%",
        maxLength: -1,
        maxLengthText: "Have no more than # character%",
        minAndMaxLengthText: "Have # to # character%",
        showNumbersAsWords: false,
        numNumbers: -1,
        numNumbersText: "Have at least # number%",
        numUppercaseLetters: -1,
        numUppercaseLettersText: "Have at least # uppercase letter%",
        numLowercaseLetters: -1,
        numLowercaseLettersText: "Have at least # lowercase letter%",
        numLetters: -1,
        numLettersText: "Have at least # letter%",
        disallowed: null,
        disallowedText: "Can't contain @",
        matchField: null,
        matchFieldText: "Match in both entry fields",
        matchPattern: null,
        matchPatternCaseSensitive: true,
        matchPatternText: "Must be in a valid format",
        disallowedPattern: null,
        disallowedPatternCaseSensitive: true,
        disallowedPatternText: "Must be in a valid format",
        validateOnStart: false,
        showAsFailOnStart: false,
        output: null,
        onComplies: null,
        onDefies: null
      };

      if (options) {
        $.extend(settings, options);
      }

      return this.each(function() {
        /**
         * Get a pointer to the field to check
         */
        var fieldForCompliance = $(this);

        /**
         * Test the text from the specified field for compliance with the configured options
         * @param text
         * @param options
         */
        function complies(text, options) {
          var results = {};
          results.minLength = options.minLength === -1 || (text.length >= options.minLength);
          results.maxLength = options.maxLength === -1 || (text.length <= options.maxLength);
          results.numNumbers = countComplies(options.numNumbers, text, /[0-9]/g);
          results.numLetters = countComplies(options.numLetters, text, /[a-zA-Z]/g);
          results.numUppercaseLetters = countComplies(options.numUppercaseLetters, text, /[A-Z]/g);
          results.numLowercaseLetters = countComplies(options.numLowercaseLetters, text, /[a-z]/g);
          results.disallowed = containsComplies(options.disallowed, text);
          results.matchField = options.matchField === null || text === $(options.matchField).val();
          results.matchPattern = patternComplies(options.matchPattern, options.matchPatternCaseSensitive, text);
          results.disallowedPattern = disallowedPatternComplies(options.disallowedPattern, options.disallowedPatternCaseSensitive, text);
          return results;
        }

        /**
         * Returns whether all of the properties on an object (but not its inherited properties)
         * are true
         * @param obj
         */
        function allRulesPass(obj) {
          for (var property in obj) {
            if (obj.hasOwnProperty(property) && !obj[property]) {
              return false;
            }
          }
          return true;
        }

        /**
         * Builds an item in the list
         * @param option
         * @param result
         * @param message
         */
        function buildItem(option, result, message) {
          var numbers = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"];
          var item = null;
          if (!(option === null || option === -1 || option.length === 0)) {
            var array = (option instanceof Array) ? option : [option];
            item = message;
            for (var index = 0; index < array.length; index++) {
              var num = (settings.showNumbersAsWords && array[index] < numbers.length) ? numbers[array[index]] : array[index];
              item = item.replace("#", num);
            }
{'fraction_non_alphanumeric': 0.11754622260315906, 'fraction_numerical': 0.005632423166401371, 'mean_word_length': 2.200626959247649, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 11, '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': '5365539', 'n_tokens_mistral': 2253, 'n_tokens_neox': 2200, 'n_words': 614}