<commit_before>var semver = require('semver');

var regex = new RegExp('(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?');
function strip(range) {
	return regex.exec(range)[0];
}

exports.isNew = function isNew(version, range) {
	return (semver.satisfies(version, range) && semver.gt(version, strip(range))) || semver.gtr(version, range);
};<commit_msg>Fix for #5 incl. console output<commit_after>var semver = require('semver');

var regex = new RegExp('(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?');
function strip(range) {
	var data = regex.exec(range);
	if (!data || data.length === 0) {
		console.error('Could not parse invalid range: ' + range);
		return null;
	}

	return data[0];
}

exports.isNew = function isNew(version, range) {
	var clean = strip(range);
	if (!clean) {
		return false;		
	}
		
	return (semver.satisfies(version, range) && semver.gt(version, clean)) || semver.gtr(version, range);
};
{'fraction_non_alphanumeric': 0.3419516263552961, 'fraction_numerical': 0.041701417848206836, 'mean_word_length': 3.819277108433735, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6108506', 'n_tokens_mistral': 586, 'n_tokens_neox': 551, 'n_words': 71}