<commit_before>'use strict'

/**
 * Dependencies
 */
const _ = require('lodash')
const path = require('path')
const glob = require('glob')
const semver = require('semver')
const Plugin = require('./Plugin')
const PluginCollection = require('./PluginCollection')

/**
 * Symbols
 */
const injector = Symbol()
const plugins = Symbol()

/**
 * Registry
 *
 * Plugins are loaded and maintained in memory by the registry. Instances of
 * the Registry class can find and load plugins from the filesystem, resolve
 * plugin dependencies, order plugins such that their dependencies are all met,
 * and initialize plugins. This process is called bootstrapping and it is the
 * beginning of the plugin lifecycle.
 */
class Registry {

  /**
   * constructor
   */
  constructor (options, _injector) {
    this.options = options
    this[injector] = _injector
    this[plugins] = {}
    this.prioritized = new PluginCollection()
    this.directories = [
      path.join(process.cwd(), 'plugins')
    ]
  }

  /**
   * get
   */
  get (name) {
    return this[plugins][name]
  }

  /**
   * set
   */
  set (name, plugin) {
    if (!(plugin instanceof Plugin)) {
      let json = JSON.stringify(plugin)
      throw new Error(`${json} is not a Plugin instance.`)
    }

    this[plugins][name] = plugin
    return plugin
  }

  /**
   * del
   */
  del (name) {
    return delete this[plugins][name]
  }

  /**
   * filter
   */
  filter (predicate) {
    console.log('UGH', this.prioritized.filter)
    return this.prioritized.filter(predicate)
  }

  /**
   * glob
   */
  glob () {
    this.files = this.directories.reduce((results, directory) => {
      let pattern = path.join(directory, '**/index.js')
      let files = glob.sync(path.resolve(pattern))
      files.forEach(filename => results.push(filename))
      return results
    }, [])

    return this
  }<commit_msg>chore(Registry): christian left his debug statement in the code...<commit_after>'use strict'

/**
 * Dependencies
 */
const _ = require('lodash')
const path = require('path')
const glob = require('glob')
const semver = require('semver')
const Plugin = require('./Plugin')
const PluginCollection = require('./PluginCollection')

/**
 * Symbols
 */
const injector = Symbol()
const plugins = Symbol()

/**
 * Registry
 *
 * Plugins are loaded and maintained in memory by the registry. Instances of
 * the Registry class can find and load plugins from the filesystem, resolve
 * plugin dependencies, order plugins such that their dependencies are all met,
 * and initialize plugins. This process is called bootstrapping and it is the
 * beginning of the plugin lifecycle.
 */
class Registry {

  /**
   * constructor
   */
  constructor (options, _injector) {
    this.options = options
    this[injector] = _injector
    this[plugins] = {}
    this.prioritized = new PluginCollection()
    this.directories = [
      path.join(process.cwd(), 'plugins')
    ]
  }

  /**
   * get
   */
  get (name) {
    return this[plugins][name]
  }

  /**
   * set
   */
  set (name, plugin) {
    if (!(plugin instanceof Plugin)) {
      let json = JSON.stringify(plugin)
      throw new Error(`${json} is not a Plugin instance.`)
    }

    this[plugins][name] = plugin
    return plugin
  }

  /**
   * del
   */
  del (name) {
    return delete this[plugins][name]
  }

  /**
   * filter
   */
  filter (predicate) {
    return this.prioritized.filter(predicate)
  }

  /**
   * glob
   */
  glob () {
    this.files = this.directories.reduce((results, directory) => {
      let pattern = path.join(directory, '**/index.js')
      let files = glob.sync(path.resolve(pattern))
      files.forEach(filename => results.push(filename))
      return results
    }, [])

    return this
  }
{'fraction_non_alphanumeric': 0.1337971635001338, 'fraction_numerical': 0.0, 'mean_word_length': 2.8575851393188856, 'pattern_counts': {'":': 0, '<': 3, '<?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': '314146', 'n_tokens_mistral': 1143, 'n_tokens_neox': 1099, 'n_words': 318}