<commit_before>export const initialState = {
  isOpen: false,
  requiredError: false,
  downloadUrl: '',
  downloadSize: ''
};

const setModalDownloadParams = (state, { payload }) => ({
  ...state,
  isOpen: payload.open,
  downloadUrl: payload.downloadUrl,
  downloadSize: payload.size
});

const setRequiredFieldsError = (state, { payload }) => {
  let isFieldRequiredEmpty = 0;
  ['firstName', 'lastName', 'organization'].forEach(f => {
    if (!payload[f] || payload[f] === '') {
      isFieldRequiredEmpty += 1;
    }
  });
  return {
    ...state,
    requiredError: isFieldRequiredEmpty > 0
  };
};

const toggleModalDownload = (state, { payload }) => ({
  ...state,
  isOpen: payload.open
});

export default {
  setModalDownloadParams,
  setRequiredFieldsError,
  toggleModalDownload
};<commit_msg>Change forEach for some loop<commit_after>export const initialState = {
  isOpen: false,
  requiredError: false,
  downloadUrl: '',
  downloadSize: ''
};

const setModalDownloadParams = (state, { payload }) => ({
  ...state,
  isOpen: payload.open,
  downloadUrl: payload.downloadUrl,
  downloadSize: payload.size
});

const setRequiredFieldsError = (state, { payload }) => {
  const requiredFields = ['firstName', 'lastName', 'organization'];
  const isFieldRequiredEmpty = requiredFields.some(
    f => !payload[f] || payload[f] === ''
  );
  return {
    ...state,
    requiredError: isFieldRequiredEmpty
  };
};

const toggleModalDownload = (state, { payload }) => ({
  ...state,
  isOpen: payload.open
});

export default {
  setModalDownloadParams,
  setRequiredFieldsError,
  toggleModalDownload
};
{'fraction_non_alphanumeric': 0.15074441687344914, 'fraction_numerical': 0.0018610421836228288, 'mean_word_length': 4.040625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7488934', 'n_tokens_mistral': 495, 'n_tokens_neox': 489, 'n_words': 107}