<commit_before>import AppDispatcher from '../dispatcher/app_dispatcher.js';
import syncClient from '../db/sync_client.js';
import {CREATE, CHANGE, DB_STORE_NAME} from '../constants/tags_constants.js';
import EventEmitter from '../event_emitter.js';

const collection = syncClient.getCollection(DB_STORE_NAME);

function getAllTags() {
  dbWrapperInstance.getAll({}).then((tags) => {
    this._tags = tags;
    this.emit(CHANGE, this._tags);
  }).catch((e) => {
    console.log('error', e);
  });
}

const TagsStore = Object.create(EventEmitter);
TagsStore.getAllTags = getAllTags;
TagsStore._tags = [];
TagsStore._handleCreate = function handleCreate(payload) {
  const data = payload.data;
  this._tags = this._tags.concat(data);
  this.emit(CHANGE, this._tags);
};

export default TagsStore;

const actionHandlers = {
  [CREATE]: TagsStore._handleCreate.bind(TagsStore)
};

AppDispatcher.register((payload) => {
  const action = payload.actionType;
  const actionHandler = actionHandlers[action];
  if (actionHandler) {
    actionHandler(payload);<commit_msg>remove undefined variable<commit_after>import AppDispatcher from '../dispatcher/app_dispatcher.js';
import syncClient from '../db/sync_client.js';
import {CREATE, CHANGE, DB_STORE_NAME} from '../constants/tags_constants.js';
import EventEmitter from '../event_emitter.js';

const collection = syncClient.getCollection(DB_STORE_NAME);

function getAllTags() {
  collection.getAll().then((tags) => {
    this._tags = tags;
    this.emit(CHANGE, this._tags);
  }).catch((e) => {
    console.log('error', e);
  });
}

const TagsStore = Object.create(EventEmitter);
TagsStore.getAllTags = getAllTags;
TagsStore._tags = [];
TagsStore._handleCreate = function handleCreate(payload) {
  const data = payload.data;
  this._tags = this._tags.concat(data);
  this.emit(CHANGE, this._tags);
};

export default TagsStore;

const actionHandlers = {
  [CREATE]: TagsStore._handleCreate.bind(TagsStore)
};

AppDispatcher.register((payload) => {
  const action = payload.actionType;
  const actionHandler = actionHandlers[action];
  if (actionHandler) {
    actionHandler(payload);
{'fraction_non_alphanumeric': 0.14494117647058824, 'fraction_numerical': 0.0, 'mean_word_length': 5.126801152737752, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '2066681', 'n_tokens_mistral': 662, 'n_tokens_neox': 665, 'n_words': 129}