<commit_before>var React = require('react');

var TestEvaluator = require('../mixins/TestEvaluator');

var If = React.createClass({
	mixins: [TestEvaluator],
	
	propTypes: {
		test: React.PropTypes.oneOfType([
			React.PropTypes.bool.isRequired,
			React.PropTypes.func.isRequired
		])
	},

	render(){
		var testResult =  this.evaluateTestProp();
		var childrenCount = React.Children.count(this.props.children);
		if(childrenCount === 0 || !testResult) return null;
		
		if (childrenCount === 1 && React.isValidElement(this.props.children)) return this.props.children;
		else return <div>{this.props.children}</div>;
	}
});

module.exports = If;<commit_msg>Not neccessary to count children.<commit_after>var React = require('react');

var TestEvaluator = require('../mixins/TestEvaluator');

var If = React.createClass({
	mixins: [TestEvaluator],
	
	propTypes: {
		test: React.PropTypes.oneOfType([
			React.PropTypes.bool.isRequired,
			React.PropTypes.func.isRequired
		])
	},

	render(){
		var testResult =  this.evaluateTestProp();
		var childrenCount = React.Children.count(this.props.children);
		if(childrenCount === 0 || !testResult) return null;
		
		if (React.isValidElement(this.props.children)) return this.props.children;
		else return <div>{this.props.children}</div>;
	}
});

module.exports = If;
{'fraction_non_alphanumeric': 0.15255530129672007, 'fraction_numerical': 0.002288329519450801, 'mean_word_length': 4.655172413793103, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1316644', 'n_tokens_mistral': 459, 'n_tokens_neox': 425, 'n_words': 79}