<commit_before>import Ember from 'ember';

var computed = Ember.computed;
var keys = Ember.keys;

export default Ember.Component.extend({
  collection: null,
  meta: null,

  proxyCollection: computed.map('collection', function(item){
    var metaKeys = this.get('metaKeys');

    return { content: item, meta: this.generateMetaObject(metaKeys, item) };
  }),

  metaKeys: computed('meta', function(){
    var meta = this.get('meta');

    if(!meta) {
      return [];
    }

    return keys(meta);
  }),

  generateMetaObject: function(metaKeys, item) {
    return metaKeys.reduce((accumulator, metaKey) => {
      accumulator[metaKey] = this.present(metaKey, item);
      return accumulator;
    }, {});
  },

  present: function(metaKey, item) {
    var metaArray = this.get('meta.' + metaKey);
    if(metaArray) {
      return metaArray.indexOf(item) !== -1
    }
  }
});<commit_msg>get rid of if statements<commit_after>import Ember from 'ember';

var computed = Ember.computed;
var keys = Ember.keys;

export default Ember.Component.extend({
  collection: null,
  meta: null,

  proxyCollection: computed.map('collection', function(item){
    var metaKeys = this.get('metaKeys');

    return { content: item, meta: this.generateMetaObject(metaKeys, item) };
  }),

  metaKeys: computed('meta', function(){
    var meta = this.get('meta') || [];

    return keys(meta);
  }),

  generateMetaObject: function(metaKeys, item) {
    return metaKeys.reduce((accumulator, metaKey) => {
      accumulator[metaKey] = this.present(metaKey, item);
      return accumulator;
    }, {});
  },

  present: function(metaKey, item) {
    var metaArray = this.get('meta.' + metaKey) || [];

    return metaArray.indexOf(item) !== -1
  }
});
{'fraction_non_alphanumeric': 0.15606936416184972, 'fraction_numerical': 0.0011560693641618498, 'mean_word_length': 3.665768194070081, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7025568', 'n_tokens_mistral': 552, 'n_tokens_neox': 535, 'n_words': 123}