<commit_before>'use strict'

/**
 * adonis-sink
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
*/

const _ = require('lodash')

/**
 * The Adonis framework is the core module containing all the required
 * classes to run an HTTP server.
 *
 * @module Adonis
 * @submodule sink
 */

/**
 * Manages configuration by recursively reading all
 * `.js` files from the `config` folder.
 *
 * @class Config
 * @constructor
 */
class Config {
  constructor () {
    this._config = {}
  }

  /**
   * Get value for a given key from the config store. Nested
   * values can be accessed via (dot notation). Values
   * referenced with `self::` are further resolved.
   *
   * @since 1.0.0
   * @method get
   *
   * @param  {String} key
   * @param  {Mixed} [defaultValue]
   *
   * @return {Mixed}
   *
   * @example
   * ```
   * Config.get('database.mysql')
   * ```
   */
  get (key, defaultValue) {
    const value = _.get(this._config, key, defaultValue)
    if (typeof (value) === 'string' && value.startsWith('self::')) {
      return this.get(value.replace('self::', ''))
    }
    return value
  }

  /**
   * Merge default values with the resolved values.
   * This is to provide a default set of values
   * when it does not exists.
   *
   * @method merge
   *
   * @param  {String} key
   * @param  {Object} defaultValues
   * @param  {Function} [customizer]
   *
   * @return {Object}
   */
  merge (key, defaultValues, customizer) {
    const value = _.get(this._config, key, {})
    return _.mergeWith(defaultValues, value, customizer)
  }

  /**
   * Update value for a given key inside the config store. If
   * value does not exists it will be created.
   *
   * ## Note
   * This method updates the value in memory and not on the
   * file system.
   *
   * @since 1.0.0
   * @method set
   *
   * @param  {String} key
   * @param  {Mixed} value
   *
   * @example
   * ```
   * Config.set('database.mysql.host', '127.0.0.1')
   *
   * // later get the value
   * Config.get('database.mysql.host')
   * ```
   */
  set (key, value) {
    _.set(this._config, key, value)
  }
}

module.exports = Config<commit_msg>fix(config): merge method should not mutate defaults object<commit_after>'use strict'

/**
 * adonis-sink
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
*/

const _ = require('lodash')

/**
 * The Adonis framework is the core module containing all the required
 * classes to run an HTTP server.
 *
 * @module Adonis
 * @submodule sink
 */

/**
 * Manages configuration by recursively reading all
 * `.js` files from the `config` folder.
 *
 * @class Config
 * @constructor
 */
class Config {
  constructor () {
    this._config = {}
  }

  /**
   * Get value for a given key from the config store. Nested
   * values can be accessed via (dot notation). Values
   * referenced with `self::` are further resolved.
   *
   * @since 1.0.0
   * @method get
   *
   * @param  {String} key
   * @param  {Mixed} [defaultValue]
   *
   * @return {Mixed}
   *
   * @example
   * ```
   * Config.get('database.mysql')
   * ```
   */
  get (key, defaultValue) {
    const value = _.get(this._config, key, defaultValue)
    if (typeof (value) === 'string' && value.startsWith('self::')) {
      return this.get(value.replace('self::', ''))
    }
    return value
  }

  /**
   * Merge default values with the resolved values.
   * This is to provide a default set of values
   * when it does not exists.
   *
   * @method merge
   *
   * @param  {String} key
   * @param  {Object} defaultValues
   * @param  {Function} [customizer]
   *
   * @return {Object}
   */
  merge (key, defaultValues, customizer) {
    const value = _.get(this._config, key, {})
    return _.mergeWith({}, defaultValues, value, customizer)
  }

  /**
   * Update value for a given key inside the config store. If
   * value does not exists it will be created.
   *
   * ## Note
   * This method updates the value in memory and not on the
   * file system.
   *
   * @since 1.0.0
   * @method set
   *
   * @param  {String} key
   * @param  {Mixed} value
   *
   * @example
   * ```
   * Config.set('database.mysql.host', '127.0.0.1')
   *
   * // later get the value
   * Config.get('database.mysql.host')
   * ```
   */
  set (key, value) {
    _.set(this._config, key, value)
  }
}

module.exports = Config
{'fraction_non_alphanumeric': 0.13918439716312056, 'fraction_numerical': 0.005319148936170213, 'mean_word_length': 2.5619573796369375, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '3056394', 'n_tokens_mistral': 1489, 'n_tokens_neox': 1480, 'n_words': 463}