<commit_before>export function flattenMeasures(measures) {
  let uniqueMeasures = [];
  measures.forEach((m) => {
    var existingMeasure = uniqueMeasures.find((i) => i.cmsId === m.cmsId);
    if (existingMeasure !== undefined) {
      existingMeasure.subMeasures.push({subId: m.subId, subtitle: m.subtitle,
                                        shortSubtitle: m.shortSubtitle});
    } else {
      var newMeasure = {cmsId: m.cmsId, name: m.name, category: m.category,
                        hqmfId: m.hqmfId, description: m.description,
                        continuousVariable: m.continuousVariable,
                        episodeOfCare: m.episodeOfCare,
                        subMeasures: []};
      newMeasure.subMeasures.push({subId: m.subId, subtitle: m.subtitle,
                                        shortSubtitle: m.shortSubtitle});
      uniqueMeasures.push(newMeasure);
    }
  });
  return uniqueMeasures;
}

export function flattenCategories(measures) {
  let categories = [];
  measures.forEach((m) => {
    if (! categories.includes(m.category)) {
      categories.push(m.category);
    }
  });
  return categories.sort();
}<commit_msg>Making code backward compatible with node.js v4.5<commit_after>export function flattenMeasures(measures) {
  let uniqueMeasures = [];
  measures.forEach((m) => {
    var existingMeasure = uniqueMeasures.find((i) => i.cmsId === m.cmsId);
    if (existingMeasure !== undefined) {
      existingMeasure.subMeasures.push({subId: m.subId, subtitle: m.subtitle,
                                        shortSubtitle: m.shortSubtitle});
    } else {
      var newMeasure = {cmsId: m.cmsId, name: m.name, category: m.category,
                        hqmfId: m.hqmfId, description: m.description,
                        continuousVariable: m.continuousVariable,
                        episodeOfCare: m.episodeOfCare,
                        subMeasures: []};
      newMeasure.subMeasures.push({subId: m.subId, subtitle: m.subtitle,
                                        shortSubtitle: m.shortSubtitle});
      uniqueMeasures.push(newMeasure);
    }
  });
  return uniqueMeasures;
}

export function flattenCategories(measures) {
  let categories = [];
  measures.forEach((m) => {
    if (categories.indexOf(m.category) === -1) {
      categories.push(m.category);
    }
  });
  return categories.sort();
}
{'fraction_non_alphanumeric': 0.12320067739204064, 'fraction_numerical': 0.0012701100762066045, 'mean_word_length': 2.241426611796982, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5491376', 'n_tokens_mistral': 689, 'n_tokens_neox': 658, 'n_words': 123}