<commit_before>'use strict';

const SuperMixologist = require('./superMixologist');
const Polttopullo = require('./polttopullo');

// Use the simple version for easy and dynamic plugin and super loading.
// Note: this can be more expensive as a result of the dynamic requires.
// const molotov = require('yourMolotov')('requiredPathToMolotovConfig');
// Now you can return the molotov promise and take action.
// molotov.getMolotov().then(molotov => {
//   // Get all of the molotov plugins for our module.
//   const molotovPlugins = molotov.exportPlugins();
// })

//  OR create your own loader class with declarative requires
// to lessen blocking operations.
// Declarative version your `MolotovLoaderClass.`
// const requireDirectory = require('require-directory');
// const supers = requireDirectory('supersDirectory');
// const plugins = requireDirectory('pathToPlugins');

// const molotov = require('molotov')('pathToMolotovConfig', supers, plugins);
// module.exports = molotov;

// Usage is fairly similar

// molotov = require('pathToYourMolotovLoaderClass');

// In the Implementing modules
// molotov.getMolotov().then(molotov => {
//   // Get all of the molotov plugins for our module.
//   const molotovPlugins = molotov.exportPlugins();
// })

module.exports = function getMolotov(molotovPath, supers, plugins) {
  if ((!molotovPath) || (typeof molotovPath !== 'string')) {
    throw new Error('molotovPath is required and must be a string.');
  }
  if ((typeof supers !== 'object')) {
    throw new Error('supers is required and must be an object');
  }
  if ((Object.keys(plugins).length === 0) || (typeof plugins !== 'object')) {
    throw new Error('plugins is required and must be an object');
  }
  const superMixologist = new SuperMixologist(molotovPath, supers);
  return superMixologist.resolve()
    .then(resolvedSupers => new Polttopullo(molotovPath, resolvedSupers, plugins));
};<commit_msg>Changes to molotov for cocktail.<commit_after>'use strict';

const SuperMixologist = require('./superMixologist');
const Polttopullo = require('./polttopullo');

// Use the simple version for easy and dynamic plugin and super loading.
// Note: this can be more expensive as a result of the dynamic requires.
// const molotov = require('yourMolotov')('requiredPathToMolotovConfig');
// Now you can return the molotov promise and take action.
// molotov.getMolotov().then(molotov => {
//   // Get all of the molotov plugins for our module.
//   const molotovPlugins = molotov.exportPlugins();
// })

//  OR create your own loader class with declarative requires
// to lessen blocking operations.
// Declarative version your `MolotovLoaderClass.`
// const requireDirectory = require('require-directory');
// const supers = requireDirectory('supersDirectory');
// const plugins = requireDirectory('pathToPlugins');

// const molotov = require('molotov')('pathToMolotovConfig', supers, plugins);
// module.exports = molotov;

// Usage is fairly similar

// molotov = require('pathToYourMolotovLoaderClass');

// In the Implementing modules
// molotov.getMolotov().then(molotov => {
//   // Get all of the molotov plugins for our module.
//   const molotovPlugins = molotov.exportPlugins();
// })

const molotov = class {
  constructor(molotovPath, supersDirectory, pluginDirectory) {
    if ((!molotovPath) || (typeof molotovPath !== 'string')) {
      throw new Error('molotovPath is required and must be a string.');
    }
    if ((typeof supersDirectory !== 'object')) {
      throw new Error('supers is required and must be an object');
    }
    if ((Object.keys(pluginDirectory).length === 0) || (typeof pluginDirectory !== 'object')) {
      throw new Error('plugins is required and must be an object');
    }
    this.setMolotovPath(molotovPath);
    this.setSupersDirectory(supersDirectory);
    this.setPluginDirectory(pluginDirectory);
  }

  setPluginDirectory(pluginDirectory) {
    this.pluginDirectory = pluginDirectory;
  }

  getPluginDirectory() {
    return this.pluginDirectory;
  }

  getSupers() {
    const superMixologist = new SuperMixologist(this.getMolotovPath(), this.getSupersDirectory());
    return superMixologist.resolve();
  }

  setMolotovPath(molotovPath) {
    this.molotovPath = molotovPath;
  }

  getMolotovPath() {
    return this.molotovPath;
  }

  setSupersDirectory(supersDirectory) {
    this.supersDirectory = supersDirectory;
  }

  getSupersDirectory() {
    return this.supersDirectory;
  }

  getMolotov() {
    return this.getSupers()
    .then(resolvedSupers => new Polttopullo(this.getMolotovPath(), resolvedSupers, this.getPluginDirectory()));
  }
};


module.exports = molotov;
{'fraction_non_alphanumeric': 0.12647881264788127, 'fraction_numerical': 0.00043020004302000433, 'mean_word_length': 4.189732142857143, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '4277188', 'n_tokens_mistral': 1417, 'n_tokens_neox': 1388, 'n_words': 386}