<commit_before>import * as ecsChanges from './changes';

const ECSController = {
  [ecsChanges.ENTITY_CREATE]: (change, store, notify) => {
    const { id, template } = change.data;
    // Manipulate change data to include entity data
    change.data.entity = store.state.create(id, template);
    notify(change);
  },
  [ecsChanges.ENTITY_REMOVE]: (change, store, notify) => {
    notify();
    store.state.remove(change.data);
  },
  [ecsChanges.SET]: (change) => {
    const { entity, key, value } = change.data;
    // notify();
    entity.set(key, value);
  },
  [ecsChanges.REMOVE]: (change) => {
    const { entity, key } = change.data;
    // notify();
    entity.remove(key);
  }
};

export default ECSController;
<commit_msg>Change entity create to call set event<commit_after>import * as ecsChanges from './changes';

const ECSController = {
  [ecsChanges.ENTITY_CREATE]: (change, store, notify) => {
    const { id, template } = change.data;
    // Manipulate change data to include entity data
    let entity = store.state.create(id);
    change.data.entity = entity;
    for (let name in template) {
      // Use template to call SET change event
      store.changes.unshift(ecsChanges.set(entity, name, template[name]));
    }
    notify(change);
  },
  [ecsChanges.ENTITY_REMOVE]: (change, store, notify) => {
    notify();
    store.state.remove(change.data);
  },
  [ecsChanges.SET]: (change) => {
    const { entity, key, value } = change.data;
    // notify();
    entity.set(key, value);
  },
  [ecsChanges.REMOVE]: (change) => {
    const { entity, key } = change.data;
    // notify();
    entity.remove(key);
  }
};

export default ECSController;

{'fraction_non_alphanumeric': 0.1573907839616996, 'fraction_numerical': 0.0, 'mean_word_length': 3.169576059850374, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4854120', 'n_tokens_mistral': 542, 'n_tokens_neox': 541, 'n_words': 129}