<commit_before>/**
 * Global methods used to get icons
 */
var fieldsMixins = {

  methods: {

    /**
     * Create the fields array recursively from a javascript object
     *
     * @param object
     */
    createFieldsRecursively: function(object) {

      var newFields = [];
      var index = 0;

      for (var field in object) {
        index = index + 1;
        if (object.hasOwnProperty(field)) {
          var newField = {
            'name': object[field].name,
            'extra_form_type': object[field].extra_form_type,
            'options':  object[field].options,
            'constraints':  object[field].constraints
          };

          // Set the first field as active
          newField.active = (index === 1 ? true : false);

          if (typeof object[field].options.configuration !== 'undefined') {
            newField.options.configuration = this.createFieldsRecursively(object[field].options.configuration);
          }

          newFields.push(newField);
        }
      }

      return newFields;
    }
  }

};<commit_msg>Fix a bug on fields when they are created form the raw<commit_after>/**
 * Global methods used to get icons
 */
var fieldsMixins = {

  methods: {

    /**
     * Create the fields array recursively from a javascript object
     *
     * @param object
     */
    createFieldsRecursively: function(object) {

      var newFields = [];
      var index = 0;

      for (var field in object) {
        index = index + 1;
        if (object.hasOwnProperty(field)) {
          // if created form the raw, the name is the key
          // if created form the configured type, the name is in the name property
          var name = typeof object[field].name === 'undefined'? field : object[field].name;
          var newField = {
            name: name,
            extra_form_type: object[field].extra_form_type,
            options:  object[field].options,
            constraints:  object[field].constraints
          };

          // Set the first field as active
          newField.active = (index === 1 ? true : false);

          if (typeof object[field].options.configuration !== 'undefined') {
            newField.options.configuration = this.createFieldsRecursively(object[field].options.configuration);
          }

          newFields.push(newField);
        }
      }

      return newFields;
    }
  }

};
{'fraction_non_alphanumeric': 0.10708263069139966, 'fraction_numerical': 0.002529510961214165, 'mean_word_length': 1.996212121212121, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6602709', 'n_tokens_mistral': 650, 'n_tokens_neox': 623, 'n_words': 177}