<commit_before>import { Injectable } from '@angular/core';
import { from } from 'rxjs';
import { flatMap, groupBy, reduce } from 'rxjs/operators';

@Injectable()
export class GroupRowsService {
  public static doGroupRows(data, groupRowsBy) {
    const grouped = [];
    from(data).pipe(
      groupBy((row) => row[groupRowsBy]),
      flatMap((group) => group.pipe(
        reduce((acc: object[], curr) => [...acc, curr], []),
      )),
    ).subscribe((row) => grouped.push(row));

    return grouped;
  }
}<commit_msg>build: added generic type to satisfy compiler when grouping rows<commit_after>import { Injectable } from '@angular/core';
import { from } from 'rxjs';
import { flatMap, groupBy, reduce } from 'rxjs/operators';

@Injectable()
export class GroupRowsService {
  public static doGroupRows<T>(data: T[], groupRowsBy) {
    const grouped = [];
    from(data).pipe(
      groupBy((row) => row[groupRowsBy]),
      flatMap((group) => group.pipe(
        reduce((acc: T[], curr: T) => [...acc, curr], []),
      )),
    ).subscribe((row) => grouped.push(row));

    return grouped;
  }
}
{'fraction_non_alphanumeric': 0.17561419472247497, 'fraction_numerical': 0.0, 'mean_word_length': 3.6610169491525424, 'pattern_counts': {'":': 0, '<': 4, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4739362', 'n_tokens_mistral': 352, 'n_tokens_neox': 350, 'n_words': 87}