<commit_before>// external dependencies
import get from 'lodash/fp/get';
import isArray from 'lodash/isArray';
import isFunction from 'lodash/isFunction';
import isPlainObject from 'lodash/isPlainObject';
import isUndefined from 'lodash/isUndefined';
import omit from 'lodash/fp/omit';
import set from 'lodash/fp/set';

// utils
import {
  createPropertyConvenienceMethod,
  getNewConfigFromObject
} from '../utils';

/**
 * @module classes/Config
 */

/**
 * @class Config
 * @classdesc configuration object builder base class
 */
class Config {
  /**
   * @function constructor
   *
   * @description
   * build the initial state of the config class
   *
   * @param {Object} [config={}] configuration to assign to the class
   * @param {Object} [options={}] additional options for instantiating the class
   * @returns {Config} configuration class
   */
  constructor(config = {}, options = {}) {
    this.config = {...config};
    this.options = {...options};

    const {
      validate
    } = this.options;

    if (isFunction(validate)) {
      this.isValid = validate(this.config);
    }

    return this;
  }

  /**
   * @instance
   * @type {Object|null}
   */
  config = null;

  /**
   * @instance
   * @type {boolean|null}
   */
  isValid = null;

  /**
   * @instance
   * @type {Object|null}
   */
  options = null;

  /**
   * @function addConvenienceMethod
   * @static
   *
   * @description
   * add a convenience method to the constructor passed
   *
   * @param {ChartConfig|OptionsConfig} Constructor constructor to assign method to
   * @returns {function(string, (function|number)): (ChartConfig|OptionsConfig)} method to add convenience method
   */
  static addMethod(Constructor) {
    return (methodName, method) => {
      if (!isFunction(method)) {
        method = createPropertyConvenienceMethod(methodName);
      }

      Object.defineProperty(Constructor.prototype, methodName, {
        configurable: false,
        enumerable: false,
        value: method,
        writable: true
      });

      return Constructor;
    };<commit_msg>Updates... * Prevent reassigning parameter, instead assigning to scoped const<commit_after>// external dependencies
import get from 'lodash/fp/get';
import isArray from 'lodash/isArray';
import isFunction from 'lodash/isFunction';
import isPlainObject from 'lodash/isPlainObject';
import isUndefined from 'lodash/isUndefined';
import omit from 'lodash/fp/omit';
import set from 'lodash/fp/set';

// utils
import {
  createPropertyConvenienceMethod,
  getNewConfigFromObject
} from '../utils';

/**
 * @module classes/Config
 */

/**
 * @class Config
 * @classdesc configuration object builder base class
 */
class Config {
  /**
   * @function constructor
   *
   * @description
   * build the initial state of the config class
   *
   * @param {Object} [config={}] configuration to assign to the class
   * @param {Object} [options={}] additional options for instantiating the class
   * @returns {Config} configuration class
   */
  constructor(config = {}, options = {}) {
    this.config = {...config};
    this.options = {...options};

    const {
      validate
    } = this.options;

    if (isFunction(validate)) {
      this.isValid = validate(this.config);
    }

    return this;
  }

  /**
   * @instance
   * @type {Object|null}
   */
  config = null;

  /**
   * @instance
   * @type {boolean|null}
   */
  isValid = null;

  /**
   * @instance
   * @type {Object|null}
   */
  options = null;

  /**
   * @function addConvenienceMethod
   * @static
   *
   * @description
   * add a convenience method to the constructor passed
   *
   * @param {ChartConfig|OptionsConfig} Constructor constructor to assign method to
   * @returns {function(string, (function|number)): (ChartConfig|OptionsConfig)} method to add convenience method
   */
  static addMethod(Constructor) {
    return (methodName, method) => {
      const methodToAssign = isFunction(method) ? method : createPropertyConvenienceMethod(methodName);

      Object.defineProperty(Constructor.prototype, methodName, {
        configurable: false,
        enumerable: false,
        value: methodToAssign,
        writable: true
      });

      return Constructor;
    };
{'fraction_non_alphanumeric': 0.12277790945721735, 'fraction_numerical': 0.0, 'mean_word_length': 3.081237911025145, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1838307', 'n_tokens_mistral': 1248, 'n_tokens_neox': 1215, 'n_words': 333}