<commit_before>'use strict'
const fs = require('fs')

class HighScoreStore {
  constructor (options) {
    this.resultFile = options && options.resultFile || './results.json'
    this.hangmanWord = options && options.hangmanWord
    this.duration = options && options.duration
    this.highScore = this.getDuration()
  }

  save () {
    var result = this.hangmanWord
    result.duration = this.duration
    try {
      if (this.duration < this.highScore) {
        fs.writeFileSync(this.resultFile, JSON.stringify(result), 'utf8')
      }
    } catch (err) {
      console.error('File exception : ' + err)
    }
  }

  fetch () {<commit_msg>fixes highscores<commit_after>'use strict'
const fs = require('fs')
const path = require('path')

class HighScoreStore {
  constructor (options) {
    this.resultFile = (options && options.resultFile) || path.join(__dirname, '../results.json')
    this.hangmanWord = options && options.hangmanWord
    this.duration = options && options.duration
    this.highScore = this.getDuration()
  }

  save () {
    var result = this.hangmanWord
    result.duration = this.duration
    try {
      if (this.duration < this.highScore) {
        fs.writeFileSync(this.resultFile, JSON.stringify(result), 'utf8')
      }
    } catch (err) {
      console.error('File exception : ' + err)
    }
  }

  fetch () {
{'fraction_non_alphanumeric': 0.13571961222967935, 'fraction_numerical': 0.0014914243102162564, 'mean_word_length': 3.005970149253731, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5794079', 'n_tokens_mistral': 411, 'n_tokens_neox': 405, 'n_words': 85}