<commit_before>function check(value, ...patterns) {
	let _check = function(value, pattern) {
		if(typeof pattern === 'undefined') {
			return (typeof value === 'undefined');
		}
		else if(pattern === null) {
			return (value === null);
		}
		else if(pattern === String) {
			return (typeof value === 'string');
		}
		else if(pattern === Array) {
			return Array.isArray(value);
		}
		else if(pattern === Number) {
			return (typeof value === 'number');
		}
		else if(pattern === Boolean) {
			return (typeof value === 'boolean');
		}
		else if(pattern === Function) {
			return (typeof value === 'function');
		}
		else if(pattern instanceof RegExp) {
			return (pattern.test(value) === true);
		}
		else if(pattern === Object) {
			return (value !== null) && (typeof value === 'object');
		}
		else if(typeof pattern === 'object') {
			return Object.keys(pattern).every((key) => _check(value[key], pattern[key]));
		}
		else {
			return (value instanceof pattern);
		}
	};

	let valid = patterns.some((pattern) => {
		if(Array.isArray(pattern)) {
			return Array.isArray(value) && value.every((subvalue) => _check(subvalue, pattern[0]));
		}
		else {
			return _check(value, pattern);
		}
	});

	if(!valid) {
		throw new TypeError(`Value ${value} is not of type ${patterns}.`);
	}
}

exports = module.exports = check;<commit_msg>refactor(object pattern): add extra check if value is object<commit_after>function check(value, ...patterns) {
	let _check = function(value, pattern) {
		if(typeof pattern === 'undefined') {
			return (typeof value === 'undefined');
		}
		else if(pattern === null) {
			return (value === null);
		}
		else if(pattern === String) {
			return (typeof value === 'string');
		}
		else if(pattern === Array) {
			return Array.isArray(value);
		}
		else if(pattern === Number) {
			return (typeof value === 'number');
		}
		else if(pattern === Boolean) {
			return (typeof value === 'boolean');
		}
		else if(pattern === Function) {
			return (typeof value === 'function');
		}
		else if(pattern instanceof RegExp) {
			return (pattern.test(value) === true);
		}
		else if(pattern === Object) {
			return (value !== null) && (typeof value === 'object');
		}
		else if(typeof pattern === 'object') {
			return _check(value, Object) && Object.keys(pattern).every((key) => _check(value[key], pattern[key]));
		}
		else {
			return (value instanceof pattern);
		}
	};

	let valid = patterns.some((pattern) => {
		if(Array.isArray(pattern)) {
			return Array.isArray(value) && value.every((subvalue) => _check(subvalue, pattern[0]));
		}
		else {
			return _check(value, pattern);
		}
	});

	if(!valid) {
		throw new TypeError(`Value ${value} is not of type ${patterns}.`);
	}
}

exports = module.exports = check;
{'fraction_non_alphanumeric': 0.18521229868228403, 'fraction_numerical': 0.0007320644216691069, 'mean_word_length': 3.7283737024221453, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2792060', 'n_tokens_mistral': 973, 'n_tokens_neox': 869, 'n_words': 225}