<commit_before>import {britechartsCustomEvents} from '../constants';

const isEventConfig = (configName) => britechartsCustomEvents.indexOf(configName) !== -1;
const isNotEventConfig = (configName) => !isEventConfig(configName);

const setChartProperty = (chart, configuration, key) => {
    if (configuration[key]) {
        chart[key](configuration[key]);
    }
};
const setChartEventHandler = (chart, configuration, key) => {
    if (configuration[key]) {
        chart.on(key, configuration[key]);
    }
};

export const applyConfiguration = (chart, configuration) => {
    let configurationProperties = Object.keys(configuration);

    // Regular properties
    configurationProperties
        .filter(isNotEventConfig)
        .forEach(setChartProperty.bind(null, chart, configuration));

    // Event related properties
    configurationProperties
        .filter(isEventConfig)
        .forEach(setChartEventHandler.bind(null, chart, configuration));

    return chart;
};
<commit_msg>Cleaning Code<commit_after>import {britechartsCustomEvents} from '../constants';

const isEventConfig = (configName) => britechartsCustomEvents.indexOf(configName) !== -1;
const isNotEventConfig = (configName) => !isEventConfig(configName);

const setChartProperty = (chart, configuration, key) => {
    if (configuration[key]) {
        chart[key](configuration[key]);
    }
};

const setChartEventHandler = (chart, configuration, key) => {
    if (configuration[key]) {
        chart.on(key, configuration[key]);
    }
};

export const applyConfiguration = (chart, configuration) => {
    let configurationProperties = Object.keys(configuration);

    // Regular properties
    configurationProperties
        .filter(isNotEventConfig)
        .forEach(setChartProperty.bind(null, chart, configuration));

    // Event related properties
    configurationProperties
        .filter(isEventConfig)
        .forEach(setChartEventHandler.bind(null, chart, configuration));

    return chart;
};

{'fraction_non_alphanumeric': 0.12279818822345244, 'fraction_numerical': 0.0010065425264217413, 'mean_word_length': 4.190600522193211, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '2869996', 'n_tokens_mistral': 522, 'n_tokens_neox': 517, 'n_words': 111}