<commit_before>import React from "react";
import { View } from "react-native";

export default props => {

	let max = props.stats[0].doc_count;
	props.stats.forEach(item => {
		if (max < item.doc_count) {
			max = item.doc_count;
		}
	});

	const range = [];
	for (let i = props.range.start; i <= props.range.end; i += props.interval) {
		range.push(i);
	}

	return (
		<View style={{ flex: 1, flexDirection: "row", height: 50, alignItems: "flex-end", paddingHorizontal: props.paddingHorizontal }}>
			{
				range.map(item => {
					const value = props.stats.find(stat => stat.key === item) || 0;

					return (
						<View
							key={item}
							style={{
								backgroundColor: "#efefef",
								width: `${100 / range.length}%`,
								height: `${(100 * value.doc_count) / max || 0}%`
							}}
						></View>
					);
				})
			}
		</View>
	);
}<commit_msg>Add prop types check for Histogram #14<commit_after>import React from "react";
import { View } from "react-native";

import types from "../../utils/propTypesHelper";

const Histogram = (props) => {

	let max = props.stats[0].doc_count;
	props.stats.forEach(item => {
		if (max < item.doc_count) {
			max = item.doc_count;
		}
	});

	const range = [];
	for (let i = props.range.start; i <= props.range.end; i += props.interval) {
		range.push(i);
	}

	return (
		<View style={{ flex: 1, flexDirection: "row", height: 50, alignItems: "flex-end", paddingHorizontal: props.paddingHorizontal }}>
			{
				range.map(item => {
					const value = props.stats.find(stat => stat.key === item) || 0;

					return (
						<View
							key={item}
							style={{
								backgroundColor: "#efefef",
								width: `${100 / range.length}%`,
								height: `${(100 * value.doc_count) / max || 0}%`
							}}
						></View>
					);
				})
			}
		</View>
	);
}

Histogram.propTypes = {
	stats: types.stats,
	range: types.range,
	interval: types.interval,
	paddingHorizontal: types.paddingHorizontal
}

export default Histogram;
{'fraction_non_alphanumeric': 0.17721518987341772, 'fraction_numerical': 0.013164556962025316, 'mean_word_length': 2.728301886792453, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 19, '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': '2467631', 'n_tokens_mistral': 851, 'n_tokens_neox': 671, 'n_words': 156}