<commit_before>import { search, array } from "../utils/utils";
import { Selection } from "../Selection";

export function selectAll(selector) {
  var subgroups = [], subgroup, node;

  selector = selectionSelectorAll(selector);

  for (var j = -1, m = this.length; ++j < m; ) {
    for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
      if (node = group[i]) {
        subgroups.push(subgroup = array(selector.call(node, node.__data__, i, j)));
        subgroup.parentNode = node;
      }
    }
  }
  return Selection.from(subgroups);
}

export function selectionSelectorAll(selector) {
  return typeof selector === "function" ? selector : function() {
    return search(this, selector);
  };
}
<commit_msg>clean up selectAll<commit_after>// @flow weak
/* eslint no-use-before-define: "off", no-underscore-dangle: "off" */

import { search, array } from '../utils/utils';
import { Selection } from '../Selection';

export function selectAll(selector) {
  const subgroups = [];

  let subgroup;
  let node;

  selector = selectionSelectorAll(selector);

  for (let j = -1, m = this.length; ++j < m;) {
    for (let group = this[j], i = -1, n = group.length; ++i < n;) {
      if (node = group[i]) { // eslint-disable-line no-cond-assign
        subgroups.push(subgroup = array(selector.call(node, node.__data__, i, j)));
        subgroup.parentNode = node;
      }
    }
  }
  return Selection.from(subgroups);
}

export function selectionSelectorAll(selector) {
  return typeof selector === 'function' ? selector : function searchSelection() {
    return search(this, selector);
  };
}

{'fraction_non_alphanumeric': 0.15927545284197375, 'fraction_numerical': 0.0024984384759525295, 'mean_word_length': 3.283422459893048, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '7430756', 'n_tokens_mistral': 505, 'n_tokens_neox': 496, 'n_words': 135}