<commit_before>const KolibriModule = require('kolibri_module');

module.exports = class ContentRenderer extends KolibriModule {
  render(contentType) {
    if ((Array.isArray(this.contentType) && this.contentType.includes(contentType)) ||
      this.contentType === contentType) {
      this.broadcastComponent(contentType);
    }
  }
  broadcastComponent(contentType) {
    this.emit(`component_render:${contentType}`, this.rendererComponent);<commit_msg>Allow content renderer modules to use a kind: [extensions...] object to define the content types they can render.<commit_after>const KolibriModule = require('kolibri_module');

module.exports = class ContentRenderer extends KolibriModule {
  render(contentType) {
    const kind = contentType.split('/')[0];
    const extension = contentType.split('/')[1];
    // Check if it is an object and not null
    if ((this.contentType === new Object(this.contentType) &&
      // Check if it has kind as a key.
      this.contentType[kind] &&
      // Check if that kind has the extension in its array
      this.contentType[kind].includes(extension)) ||
      this.contentType === contentType) {
      this.broadcastComponent(contentType);
    }
  }
  broadcastComponent(contentType) {
    this.emit(`component_render:${contentType}`, this.rendererComponent);
{'fraction_non_alphanumeric': 0.12070282658517953, 'fraction_numerical': 0.0015278838808250573, 'mean_word_length': 4.261044176706827, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4886180', 'n_tokens_mistral': 359, 'n_tokens_neox': 364, 'n_words': 88}