<commit_before>import utilData from '../util/data';

var MutationObserver = window.MutationObserver || window.SkateMutationObserver;

export default function (elem, func) {
  var data = utilData(elem);

  if (!data.elementObserverHandlers) {
    data.elementObserverHandlers = [];
    data.elementObserver = new MutationObserver(function mutationObserverHandler (mutations) {
      mutations.forEach(mutation =>
        data.elementObserverHandlers.forEach(mutationHandler =>
          mutationHandler(mutation.addedNodes || [], mutation.removedNodes || [])
        )
      );
    });
    data.elementObserver.observe(elem, {
      childList: true,
      subtree: true
    });
  }

  data.elementObserverHandlers.push(func);
}
<commit_msg>ES6 arrow func.<commit_after>import utilData from '../util/data';

var MutationObserver = window.MutationObserver || window.SkateMutationObserver;

export default function (elem, func) {
  var data = utilData(elem);

  if (!data.elementObserverHandlers) {
    data.elementObserverHandlers = [];
    data.elementObserver = new MutationObserver(mutations =>
      mutations.forEach(mutation =>
        data.elementObserverHandlers.forEach(mutationHandler =>
          mutationHandler(mutation.addedNodes || [], mutation.removedNodes || [])
        )
      )
    );
    data.elementObserver.observe(elem, {
      childList: true,
      subtree: true
    });
  }

  data.elementObserverHandlers.push(func);
}

{'fraction_non_alphanumeric': 0.11772853185595568, 'fraction_numerical': 0.0006925207756232687, 'mean_word_length': 3.6019108280254777, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '868269', 'n_tokens_mistral': 413, 'n_tokens_neox': 407, 'n_words': 68}