<commit_before>import Ember from 'ember';
import _ from 'lodash';

export default Ember.Component.extend({
  member_name: '',
  member_value: '',
  memberAlert: '',
  showAlert: false,
  members: Ember.A(),
  actions: {
    addMember: function () {
      var self = this;
      self.set('memberAlert','');
      self.set('showAlert',false);

      var members = this.get('members');
      if(_.any(members,'member_name',this.get('member_name'))){
        self.set('memberAlert','A custom value with that key already exists');
        self.set('showAlert',true);
        return;
      }
      var member = {};
      var member_name = this.get('member_name');
      var member_value = this.get('member_value');
      if(member_name && member_value) {
        member.member_name = member_name;
        try{
          member.member_value = JSON.parse(member_value);
        }
        catch(e){
          if(/Unexpected token.*/.test(e.message)){
            self.set('memberAlert','There was a problem parsing the value.  Make sure it is valid JSON');
            self.set('showAlert',true);
            return;
          }
        }
        members.pushObject(member);
        this.sendAction('action', 'add', member);
        self.set('member_name', '');
        self.set('member_value', '');
      }
    },
    removeMember: function(member){
      var members = this.get('members');
      members.removeObject(member);<commit_msg>Added to alert about strings<commit_after>import Ember from 'ember';
import _ from 'lodash';

export default Ember.Component.extend({
  member_name: '',
  member_value: '',
  memberAlert: '',
  showAlert: false,
  members: Ember.A(),
  actions: {
    addMember: function () {
      var self = this;
      self.set('memberAlert','');
      self.set('showAlert',false);

      var members = this.get('members');
      if(_.any(members,'member_name',this.get('member_name'))){
        self.set('memberAlert','A custom value with that key already exists');
        self.set('showAlert',true);
        return;
      }
      var member = {};
      var member_name = this.get('member_name');
      var member_value = this.get('member_value');
      if(member_name && member_value) {
        member.member_name = member_name;
        try{
          member.member_value = JSON.parse(member_value);
        }
        catch(e){
          if(/Unexpected token.*/.test(e.message)){
            self.set('memberAlert','There was a problem parsing the value.  Make sure it is valid JSON (strings must be wrapped in quotes)');
            self.set('showAlert',true);
            return;
          }
        }
        members.pushObject(member);
        this.sendAction('action', 'add', member);
        self.set('member_name', '');
        self.set('member_value', '');
      }
    },
    removeMember: function(member){
      var members = this.get('members');
      members.removeObject(member);
{'fraction_non_alphanumeric': 0.14771556166265887, 'fraction_numerical': 0.0, 'mean_word_length': 2.5468940316686965, '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': '2735193', 'n_tokens_mistral': 845, 'n_tokens_neox': 836, 'n_words': 177}