<commit_before>var loadFileOnServer = require('../src/server/http-get.js');

function GroupedKata(katasUrl) {
  
  this.load = function(onError, onSuccess) {
    function onLoaded(err, data) {
      var parsed;
      try {
        parsed = JSON.parse(data);
      } catch (jsonParseError) {
        onError(jsonParseError);
      }
      if (err) {
        onError(err);
      } else if (!('groups' in parsed)) {
        onError(new Error('No groups found in the data'));
      } else {
        onSuccess(parsed.groups);
      }
    }

    loadFileOnServer(katasUrl, onLoaded);
  }
}

module.exports = GroupedKata;<commit_msg>Make GroupedKatas a real ES6 class.<commit_after>import {loadFileOnServer} from '../src/server/http-get.js';

export default class GroupedKata{
  constructor(katasUrl){
    this.katasUrl = katasUrl;
  }
  
  load(onError, onSuccess) {
    function onLoaded(err, data) {
      var parsed;
      try {
        parsed = JSON.parse(data);
      } catch (jsonParseError) {
        onError(jsonParseError);
      }
      if (err) {
        onError(err);
      } else if (!('groups' in parsed)) {
        onError(new Error('No groups found in the data'));
      } else {
        onSuccess(parsed.groups);
      }
    }

    loadFileOnServer(this.katasUrl, onLoaded);
  }
}
{'fraction_non_alphanumeric': 0.12935708752904726, 'fraction_numerical': 0.000774593338497289, 'mean_word_length': 2.445333333333333, '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': '7178789', 'n_tokens_mistral': 422, 'n_tokens_neox': 421, 'n_words': 87}