<commit_before>/**
 * Add cors headers to event
 */
export default () => (req, res) => {
  const corsHeaders = {
    'Access-Control-Allow-Origin': '*',
    'Access-Control-Allow-Credentials': true,
    'Access-Control-Allow-Methods': 'POST, GET, PUT, PATCH, DELETE, OPTIONS'
  }

  res.headers = {
    ...corsHeaders,
    ...res.headers
  }
}<commit_msg>cors middleware to be conditional<commit_after>/**
 * Add cors headers to event
 */
export default (useCors) => (req, res) => {
  if (useCors) {
    const corsHeaders = {
      'Access-Control-Allow-Origin': '*',
      'Access-Control-Allow-Credentials': true,
      'Access-Control-Allow-Methods': 'POST, GET, PUT, PATCH, DELETE, OPTIONS'
    }

    res.headers = {
      ...corsHeaders,
      ...res.headers
    }
  }
}
{'fraction_non_alphanumeric': 0.17268041237113402, 'fraction_numerical': 0.0, 'mean_word_length': 2.753623188405797, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2062033', 'n_tokens_mistral': 272, 'n_tokens_neox': 265, 'n_words': 57}