<commit_before>/**
 * Array flatten
 *   Use `Array.reduce()` to get all elements inside the array and `concat()` to flatten them.
 * @param arr
 */
function flatten(arr) {
  return arr.reduce((a, v) => a.concat(v), []); // flatten([1,[2],3,4]) -> [1,2,3,4]
}

export { flatten };
<commit_msg>updated flatten function to be recursive<commit_after>/**
 * Array flatten
 *   Use `Array.reduce()` to get all elements inside the array recursively and `concat()` to flatten them.
 * @param arr
 */
function flatten(arr) {
  return arr.reduce((flat, toFlatten) => {
    return flat.concat(Array.isArray(toFlatten) ? flatten(toFlatten) : toFlatten);
  }, []);
}

export { flatten };

{'fraction_non_alphanumeric': 0.17159763313609466, 'fraction_numerical': 0.011834319526627219, 'mean_word_length': 4.128787878787879, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '5483843', 'n_tokens_mistral': 233, 'n_tokens_neox': 227, 'n_words': 65}