<commit_before>import SelectOption from '../SelectOption';

/**
 * Convert children of `<SelectOptions>` components to array of options.
 *
 * @param {array} childrenArray - Array of `<SelectOptions>` components
 * @returns {array}
 */
function parseSelectOptions(childrenArray = []) {
    const results = [];

    childrenArray.forEach((child) => {
        if (child && child.type === SelectOption) {
            results.push(child.props);
        }
    });

    return results;
}

export default parseSelectOptions;<commit_msg>Use 'React.Children.forEach()' to handle where children might not be array<commit_after>import { Children } from 'react';
import SelectOption from '../SelectOption';

/**
 * Convert children of `<SelectOptions>` components to array of options.
 *
 * @param {ReactChildren} children - children of `<SelectOptions>`
 * @returns {array}
 */
function parseSelectOptions(children) {
    const results = [];

    Children.forEach(children, (child) => {
        if (child && child.type === SelectOption) {
            results.push(child.props);
        }
    });

    return results;
}

export default parseSelectOptions;
{'fraction_non_alphanumeric': 0.13385826771653545, 'fraction_numerical': 0.0, 'mean_word_length': 3.46875, 'pattern_counts': {'":': 0, '<': 7, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1681829', 'n_tokens_mistral': 308, 'n_tokens_neox': 300, 'n_words': 86}