<commit_before>/*!
 * Expose `Poplar`.
 */
module.exports = Poplar;

/*!
 * Module dependencies.
 */
var EventEmitter = require('events').EventEmitter;
var debug = require('debug')('poplar:apis');
var util = require('util');
var Url = require('url');
var inherits = util.inherits;
var assert = require('assert');
var path = require('path');
var _ = require('lodash');
var minimatch = require('minimatch');

var Dynamic = require('./dynamic');
var ApiBuilder = require('./api_builder');

/*!
 * Object containing __locals.
 */
var __locals = {};

/**
 * Poplar constructor
 * @class
 * @param {Object} options Poplar options object
 */
function Poplar(options) {
  // call super
  EventEmitter.call(this);

  // Avoid warning: possible EventEmitter memory leak detected
  this.setMaxListeners(16);

  this.options = options || {};
  this._apiBuilders = {};
  this._methods = {};
  this._listenerTree = {};
  this.setBasePath(this.options.basePath || '/');
}

/**
 * Simplified API for creating Poplar instance, equals to `new Poplar(options)`
 * @param {Object} options Poplar options
 * @return {Poplar} Poplar instance
 */
Poplar.create = function(options) {
  return new Poplar(options);
};

/*!
 * Inherit from `EventEmitter`.
 */
inherits(Poplar, EventEmitter);

/**
 * Assigns configuration name to value
 * Retrieve the value of a configuration with Poplar.get().
 */
Poplar.set = Poplar.prototype.set = function(name, obj, mode) {
  mode = mode || 'overwrite';
  switch(mode){
    case 'overwrite':
      __locals[name] = obj;
      break;
    case 'extend':
      var original = __locals[name];
      __locals[name] = util._extend(original, obj);
      break;
  }
};

/**
 * Unsets the configuration name to undefined
 *<commit_msg>#set option extend the original object<commit_after>/*!
 * Expose `Poplar`.
 */
module.exports = Poplar;

/*!
 * Module dependencies.
 */
var EventEmitter = require('events').EventEmitter;
var debug = require('debug')('poplar:apis');
var util = require('util');
var Url = require('url');
var inherits = util.inherits;
var assert = require('assert');
var path = require('path');
var _ = require('lodash');
var minimatch = require('minimatch');

var Dynamic = require('./dynamic');
var ApiBuilder = require('./api_builder');

/*!
 * Object containing __locals.
 */
var __locals = {};

/**
 * Poplar constructor
 * @class
 * @param {Object} options Poplar options object
 */
function Poplar(options) {
  // call super
  EventEmitter.call(this);

  // Avoid warning: possible EventEmitter memory leak detected
  this.setMaxListeners(16);

  this.options = options || {};
  this._apiBuilders = {};
  this._methods = {};
  this._listenerTree = {};
  this.setBasePath(this.options.basePath || '/');
}

/**
 * Simplified API for creating Poplar instance, equals to `new Poplar(options)`
 * @param {Object} options Poplar options
 * @return {Poplar} Poplar instance
 */
Poplar.create = function(options) {
  return new Poplar(options);
};

/*!
 * Inherit from `EventEmitter`.
 */
inherits(Poplar, EventEmitter);

/**
 * Assigns configuration name to value
 * Retrieve the value of a configuration with Poplar.get().
 */
Poplar.set = Poplar.prototype.set = function(name, obj, mode) {
  mode = mode || 'overwrite';
  switch(mode){
    case 'overwrite':
      __locals[name] = obj;
      break;
    case 'extend':
      util._extend(__locals[name], obj);
      break;
  }
};

/**
 * Unsets the configuration name to undefined
 *
{'fraction_non_alphanumeric': 0.15620480185131616, 'fraction_numerical': 0.0011570726063060456, 'mean_word_length': 3.9119318181818183, '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': '709520', 'n_tokens_mistral': 1062, 'n_tokens_neox': 1101, 'n_words': 287}