<commit_before>'use strict';

const qEngine = require('json-query');

const fetch = require('./Fetcher');
const { apiBase } = require('../CommonFunctions');

const relicBase = 'https://drops.warframestat.us/data/relics';

function toTitleCase(str) {
  return str.replace(/\w\S*/g, txt => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase());
}

module.exports = class WorldStateClient {
  /**
   * @type {Logger} logger for tracing
   */
  #logger;

  static #weapons;
  static #warframes;
  static #mods;

  /**
   * Create a worldstate client
   * @param {Logger|console} logger logger for debugging requests
   */
  constructor(logger = console) {
    this.#logger = logger;
    if (!WorldStateClient.#weapons) {
      (async function init() {
        if (!WorldStateClient.#weapons) {
          WorldStateClient.#weapons = await fetch(`${apiBase}/weapons`);
          const misc = (await fetch(`${apiBase}/items`))
            .filter(i => i.uniqueName.includes('OperatorAmplifiers'));
          WorldStateClient.#weapons.push(...misc);
        }
      }());
    }

    if (!WorldStateClient.#warframes) {
      (async function init() {
        if (!WorldStateClient.#warframes) {
          WorldStateClient.#warframes = await fetch(`${apiBase}/warframes`);
        }
      }());
    }

    if (!WorldStateClient.#mods) {<commit_msg>fix(worldstate): check for uniqueName<commit_after>'use strict';

const qEngine = require('json-query');

const fetch = require('./Fetcher');
const { apiBase } = require('../CommonFunctions');

const relicBase = 'https://drops.warframestat.us/data/relics';

function toTitleCase(str) {
  return str.replace(/\w\S*/g, txt => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase());
}

module.exports = class WorldStateClient {
  /**
   * @type {Logger} logger for tracing
   */
  #logger;

  static #weapons;
  static #warframes;
  static #mods;

  /**
   * Create a worldstate client
   * @param {Logger|console} logger logger for debugging requests
   */
  constructor(logger = console) {
    this.#logger = logger;
    if (!WorldStateClient.#weapons) {
      (async function init() {
        if (!WorldStateClient.#weapons) {
          WorldStateClient.#weapons = await fetch(`${apiBase}/weapons`);
          const misc = (await fetch(`${apiBase}/items`))
            .filter(i => i?.uniqueName?.includes('OperatorAmplifiers'));
          WorldStateClient.#weapons.push(...misc);
        }
      }());
    }

    if (!WorldStateClient.#warframes) {
      (async function init() {
        if (!WorldStateClient.#warframes) {
          WorldStateClient.#warframes = await fetch(`${apiBase}/warframes`);
        }
      }());
    }

    if (!WorldStateClient.#mods) {
{'fraction_non_alphanumeric': 0.16334808259587022, 'fraction_numerical': 0.0014749262536873156, 'mean_word_length': 3.0252225519287834, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '7228581', 'n_tokens_mistral': 861, 'n_tokens_neox': 844, 'n_words': 163}