util/Constants.js

const Package = require("../../package.json");
const browser = exports.browser = typeof window !== "undefined";

exports.UserAgent = browser
  ? null
  : `Mozilla/5.0 (${process.platform}) AppleWebKit/537.36 (KHTML, like Gecko) ThunderAPI/${Package.version}`;

/**
 * URLs to access specific endpoints. These are:
 * * https://warthunder.com/en
 * * https://warthunder.com/en/community/userinfo
 * * https://warthunder.com/en/community/claninfo
 * * https://warthunder.com/news3-en.html
 * * https://static.warthunder.com
 * * https://wiki.warthunder.com
 * @typedef {string} WTEndPointURL
 */
exports.URLs = {
  main: "https://warthunder.com/en",
  user: "https://warthunder.com/en/community/userinfo",
  clan: "https://warthunder.com/en/community/claninfo",
  news: "https://warthunder.com/news3-en.html",
  static: "https://static.warthunder.com",
  wiki: "https://wiki.warthunder.com"
};

/**
 * Endpoints to access the War Thunder site. These are:
 * * main
 * * user
 * * clan
 * * news
 * * static
 * * wiki
 * @typedef {string} WTEndPoint
 */
exports.EndPoints = keyMirror([
  "main",
  "user",
  "clan",
  "news",
  "static",
  "wiki"
]);

function keyMirror(arr) {
  const tmp = Object.create(null);
  for (const value of arr) tmp[value] = value;
  return tmp;
}