<commit_before>// [VexFlow](http://vexflow.com) - Copyright (c) <NAME> 2010.
// @author <NAME>
//
// ## Description
//
// This file implements a registry for VexFlow elements. It allows users
// to track, query, and manage some subset of generated elements, and
// dynamically get and set attributes.
//
// There are two ways to regiser with a registry:
//
// 1) Explicitly call `element.register(registry)`, or,
// 2) Call `Registry.enableDefaultRegistry(registry)` when ready, and all future
//    elements will automatically register with it.
//
// Once an element is registered, selected attributes are tracked and indexed by
// the registry. This allows fast look up of elements by attributes like id, type,
// and class.

export class X extends Error {
  constructor(message, data) {
    super(message);
    this.name = 'RegistryException';
    this.message = message;
    this.data = data;
  }
}

function setIndex(index, name, value, id, elem) {
  if (!index[name][value]) index[name][value] = {}
  index[name][value][id] = elem;
}

export class Registry {
  static get INDEXES() { return ['type', 'class']; }

  constructor() {
    this.clear();
  }

  static enableDefaultRegistry(registry) {
    Registry.defaultRegistry = registry;
  }<commit_msg>Fix eslint errors.<commit_after>// [VexFlow](http://vexflow.com) - Copyright (c) <NAME> 2010.
// @author <NAME>
//
// ## Description
//
// This file implements a registry for VexFlow elements. It allows users
// to track, query, and manage some subset of generated elements, and
// dynamically get and set attributes.
//
// There are two ways to regiser with a registry:
//
// 1) Explicitly call `element.register(registry)`, or,
// 2) Call `Registry.enableDefaultRegistry(registry)` when ready, and all future
//    elements will automatically register with it.
//
// Once an element is registered, selected attributes are tracked and indexed by
// the registry. This allows fast look up of elements by attributes like id, type,
// and class.

export class X extends Error {
  constructor(message, data) {
    super(message);
    this.name = 'RegistryException';
    this.message = message;
    this.data = data;
  }
}

function setIndex(index, name, value, id, elem) {
  if (!index[name][value]) index[name][value] = {};
  index[name][value][id] = elem;
}

export class Registry {
  static get INDEXES() { return ['type', 'class']; }

  constructor() {
    this.clear();
  }

  static enableDefaultRegistry(registry) {
    Registry.defaultRegistry = registry;
  }
{'fraction_non_alphanumeric': 0.13074484944532488, 'fraction_numerical': 0.004754358161648178, 'mean_word_length': 3.590909090909091, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1252338', 'n_tokens_mistral': 744, 'n_tokens_neox': 714, 'n_words': 266}