<commit_before>var semver = require('semver')
var util = require('util')
var _ = require('lodash')
var getPackageJson = require('./getPackageJson.js')
var extractLink = require('./extractLink.js')
var extractLicense = require('./extractLicense.js')

module.exports = getPackageReportData

/*
	collect the data for a single package
*/
function getPackageReportData(packageEntry, callback) {

	if (typeof callback !== 'function') {
		throw new Error('missing callback argument')
	}
	
	var installedVersion = packageEntry.version
	if (installedVersion.match('^[\^~].*')) {
		installedVersion = installedVersion.substring(1);
	}

	var localVersion = semver.validRange(packageEntry.version)

	if (!localVersion) {
		var message = util.format('skipping %s (invalid semversion)', toPackageString(packageEntry))
		
		//**
		return callback(null, { name: packageEntry.fullName, comment: message })
	}

	var fullPackageName = packageEntry.fullName
<commit_msg>replace string in match for semver range specifier with regex<commit_after>var semver = require('semver')
var util = require('util')
var _ = require('lodash')
var getPackageJson = require('./getPackageJson.js')
var extractLink = require('./extractLink.js')
var extractLicense = require('./extractLicense.js')

module.exports = getPackageReportData

/*
	collect the data for a single package
*/
function getPackageReportData(packageEntry, callback) {

	if (typeof callback !== 'function') {
		throw new Error('missing callback argument')
	}
	
	var installedVersion = packageEntry.version
	if (installedVersion.match(/^[\^~].*/)) {
		installedVersion = installedVersion.substring(1);
	}

	var localVersion = semver.validRange(packageEntry.version)

	if (!localVersion) {
		var message = util.format('skipping %s (invalid semversion)', toPackageString(packageEntry))
		
		//**
		return callback(null, { name: packageEntry.fullName, comment: message })
	}

	var fullPackageName = packageEntry.fullName

{'fraction_non_alphanumeric': 0.1293634496919918, 'fraction_numerical': 0.001026694045174538, 'mean_word_length': 5.369281045751634, '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': '3072763', 'n_tokens_mistral': 576, 'n_tokens_neox': 541, 'n_words': 141}