<commit_before>import React from 'react';
import findAll from './find-all';

/**
 * Returns true if the given parameter classNameList contains the
 * given paramter className.
 *
 * @param  {String}  classNameList String of all class names
 * @param  {String}  className     The class name to search for
 * @return {Boolean}
 */
function hasClassName(classNameList, className) {
  return ` ${classNameList} `.indexOf(` ${className} `) !== -1;
}

/**
 * Finds all instances of components in the tree with a class that matches
 * `className`.
 *
 * This is different to React's `scryRenderedDOMComponentsWithClass` in that
 * it will check *all* components and not just DOM components.
 *
 * @param  {ReactComponent} tree  the rendered tree to traverse
 * @param  {String} className     the class to find
 * @return {Array}                all matching components
 */
export default function findAllWithClass(tree, className) {
  return findAll(tree, component => {
    if (React.isValidElement(component)) {
      if(component.props.className != null) {

        if (className.includes('.')) {
          const classNameList = className.split('.');

          return classNameList.every(function(val) {<commit_msg>Changed from `string.includes` to `string.indexOf`<commit_after>import React from 'react';
import findAll from './find-all';

/**
 * Returns true if the given parameter classNameList contains the
 * given paramter className.
 *
 * @param  {String}  classNameList String of all class names
 * @param  {String}  className     The class name to search for
 * @return {Boolean}
 */
function hasClassName(classNameList, className) {
  return ` ${classNameList} `.indexOf(` ${className} `) !== -1;
}

/**
 * Finds all instances of components in the tree with a class that matches
 * `className`.
 *
 * This is different to React's `scryRenderedDOMComponentsWithClass` in that
 * it will check *all* components and not just DOM components.
 *
 * @param  {ReactComponent} tree  the rendered tree to traverse
 * @param  {String} className     the class to find
 * @return {Array}                all matching components
 */
export default function findAllWithClass(tree, className) {
  return findAll(tree, component => {
    if (React.isValidElement(component)) {
      if(component.props.className != null) {

        if (className.indexOf('.') !== -1) {
          const classNameList = className.split('.');

          return classNameList.every(function(val) {
{'fraction_non_alphanumeric': 0.11115618661257606, 'fraction_numerical': 0.0012170385395537525, 'mean_word_length': 3.6007462686567164, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4595718', 'n_tokens_mistral': 656, 'n_tokens_neox': 654, 'n_words': 241}