<commit_before>const _lowercase = (rawObj) => {
  const obj = {}

  for (const [k, v] of Object.entries(rawObj)) {
    obj[k.toLowerCase()] = (typeof v === 'object' ? _lowercase(v) : v)
  }

  return obj
}

const lowercase = async (ctx, next) => {
  await next()
  if (typeof ctx.body === 'object') {
    ctx.body = _lowercase(ctx.body)
  }
}

module.exports = lowercase<commit_msg>fix array in lowercase<commit_after>const _lowercase = (rawObj) => {
  let obj = null
  if (rawObj instanceof Array) {
    console.log(rawObj)
    obj = []
    for (const v of rawObj) {
      obj.push(_lowercase(v))
    }
  } else if (rawObj instanceof Object) {
    obj = {}
    for (const [k, v] of Object.entries(rawObj)) {
      obj[k.toLowerCase()] = _lowercase(v)
    }
  } else {
    obj = rawObj
  }

  return obj
}

const lowercase = async (ctx, next) => {
  await next()
  ctx.body = _lowercase(ctx.body)
}

module.exports = lowercase
{'fraction_non_alphanumeric': 0.15334773218142547, 'fraction_numerical': 0.0, 'mean_word_length': 2.9615384615384617, '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': '1754259', 'n_tokens_mistral': 337, 'n_tokens_neox': 341, 'n_words': 84}