"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.updateHighScore = exports.setHighScore = exports.getHighScore = void 0;
require("core-js/modules/es.parse-int.js");
require("core-js/modules/es.regexp.to-string.js");
// gets/stores highscore in the local storage

const HIGH_SCORE_TAG = "@robotical-skiing-game-high-score";
const getHighScore = () => {
  const highScore = localStorage.getItem(HIGH_SCORE_TAG);
  if (!highScore) {
    return 0;
  }
  return parseInt(highScore);
};
exports.getHighScore = getHighScore;
const setHighScore = score => {
  localStorage.setItem(HIGH_SCORE_TAG, score.toString());
};
exports.setHighScore = setHighScore;
const updateHighScore = score => {
  const highScore = getHighScore();
  if (score > highScore) {
    setHighScore(score);
  }
};
exports.updateHighScore = updateHighScore;