<commit_before>// external dependencies
import isArray from 'lodash/fp/isArray';
import isNAN from 'lodash/fp/isNaN';
import isPlainObject from 'lodash/fp/isPlainObject';
import isUndefined from 'lodash/fp/isUndefined';
import toPath from 'lodash/fp/toPath';

// classes
import Config from './Config';

// constants
import {
  CHART_CONVENIENCE_METHOD_NAMES
} from '../constants';

// utils
import {
  getMatchingChartIndices,
  getNewChartSeries,
  getNewConfigWithSeries
} from '../utils';

/**
 * @module classes/ChartConfig
 */

/**
 * @private
 *
 * @class ChartConfig
 * @classdesc configuration object builder for charts
 */
class ChartConfig extends Config {
  /**
   * @function addChart
   *
   * @description
   * add a chart type with provided series
   *
   * @param {string} type chart type to add to config
   * @param {Array<Object>} seriesPassed data series to populate chart with
   * @returns {ChartConfig} new config class
   */
  addChart(type, seriesPassed) {
    let series;

    if (isArray(seriesPassed)) {
      series = seriesPassed;
    } else if (isPlainObject(seriesPassed)) {
      series = [seriesPassed];
    } else {
      throw new TypeError('Series passed must be either a plain object or an array of plain objects.');
    }

    const config = getNewConfigWithSeries(this.config, type, getNewChartSeries(series, type));

    return new ChartConfig(config, this.options);
  }

  /**
   * @function removeChart
   *
   * @description
   * remove an instance of a chart type, all instances, or all charts
   *
   * @param {string} [chartPath] chart type with optional index
   * @returns {ChartConfig} new config class
   */
  removeChart(chartPath) {
    if (isUndefined(chartPath)) {
      return this.remove('series');
    }

    const {
      series: currentSeries = []<commit_msg>Updates... * Fix getNewConfigWithSeries call still including type<commit_after>// external dependencies
import isArray from 'lodash/fp/isArray';
import isNAN from 'lodash/fp/isNaN';
import isPlainObject from 'lodash/fp/isPlainObject';
import isUndefined from 'lodash/fp/isUndefined';
import toPath from 'lodash/fp/toPath';

// classes
import Config from './Config';

// constants
import {
  CHART_CONVENIENCE_METHOD_NAMES
} from '../constants';

// utils
import {
  getMatchingChartIndices,
  getNewChartSeries,
  getNewConfigWithSeries
} from '../utils';

/**
 * @module classes/ChartConfig
 */

/**
 * @private
 *
 * @class ChartConfig
 * @classdesc configuration object builder for charts
 */
class ChartConfig extends Config {
  /**
   * @function addChart
   *
   * @description
   * add a chart type with provided series
   *
   * @param {string} type chart type to add to config
   * @param {Array<Object>} seriesPassed data series to populate chart with
   * @returns {ChartConfig} new config class
   */
  addChart(type, seriesPassed) {
    let series;

    if (isArray(seriesPassed)) {
      series = seriesPassed;
    } else if (isPlainObject(seriesPassed)) {
      series = [seriesPassed];
    } else {
      throw new TypeError('Series passed must be either a plain object or an array of plain objects.');
    }

    const config = getNewConfigWithSeries(this.config, getNewChartSeries(series, type));

    return new ChartConfig(config, this.options);
  }

  /**
   * @function removeChart
   *
   * @description
   * remove an instance of a chart type, all instances, or all charts
   *
   * @param {string} [chartPath] chart type with optional index
   * @returns {ChartConfig} new config class
   */
  removeChart(chartPath) {
    if (isUndefined(chartPath)) {
      return this.remove('series');
    }

    const {
      series: currentSeries = []
{'fraction_non_alphanumeric': 0.10776330076004344, 'fraction_numerical': 0.0, 'mean_word_length': 3.4290865384615383, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2330550', 'n_tokens_mistral': 1108, 'n_tokens_neox': 1095, 'n_words': 333}