<commit_before>'use strict';

/**
 * MenuItem Class
 * @class
 * @example
  <code>
  tinymce.activeEditor.addMenuItem(new MenuItem('myAction',{
    icon: 'text',
    text: 'My Action',
    onclick: function(){
     window.alert('overiden default onclick action');
    }
  }));
  </code>
 */
function MenuItem(name,options){
  this.name = name;
  if (!this.id) {
    this.id =  'mce-plugin-headersfooters-' + name.camel2Dash();
  }
  for (var key in options) {
    this[key] = options[key];
  }
}

/**
 * Converts a camel cased string to a dashed string
 * @method
 * @extends String
 * @example
 * <code>
    var s = 'camelCase';
    s.camel2Dash()
    // -> camel-case
    </code>
 */
String.prototype.camel2Dash = function(){
  return this.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
};

/**<commit_msg>add support for 'visible' and 'disabled' MenuItem constructor arguments<commit_after>'use strict';

/**
 * MenuItem Class
 * @class
 * @example
  <code>
  tinymce.activeEditor.addMenuItem(new MenuItem('myAction',{
    icon: 'text',
    text: 'My Action',
    visible: true,
    disabled: true,
    onclick: function(){
     window.alert('overiden default onclick action');
    }
  }));
  </code>
 */
function MenuItem(name,options){
  this.name = name;
  for (var key in options) {
    if (key !== 'visible' && key !== 'disabled') {
      this[key] = options[key];
    }
  }
  if (!options.id) {
    this.id =  'mce-plugin-headersfooters-' + name.camel2Dash();
  }
  if (options.visible === false) this.hide();
  if (options.disabled) this.disable(); 
}

/**
 * Converts a camel cased string to a dashed string
 * @method
 * @extends String
 * @example
 * <code>
    var s = 'camelCase';
    s.camel2Dash()
    // -> camel-case
    </code>
 */
String.prototype.camel2Dash = function(){
  return this.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
};

/**
{'fraction_non_alphanumeric': 0.18663101604278076, 'fraction_numerical': 0.0053475935828877, 'mean_word_length': 3.0851528384279474, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '5684867', 'n_tokens_mistral': 664, 'n_tokens_neox': 667, 'n_words': 148}