{"size": 1695, "ext": "js", "max_stars_repo_path": "web/src/util/project.js", "max_stars_repo_name": "GuiRitter/VisualStudioSolutionMerger", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "web/src/util/project.js", "max_issues_repo_name": "GuiRitter/VisualStudioSolutionMerger", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "web/src/util/project.js", "max_forks_repo_name": "GuiRitter/VisualStudioSolutionMerger", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.7288135593, "max_line_length": 152, "alphanum_fraction": 0.6548672566}
let compareProjects = (projectA, projectB) => {
	let projectKeysA = Object.keys(projectA);
	let projectKeysB = Object.keys(projectB);
	if (projectKeysA.length < projectKeysB.length) {
		return -1;
	} else if (projectKeysA.length > projectKeysB.length) {
		return 1;
	}
	projectKeysA = projectKeysA.sort();
	projectKeysB = projectKeysB.sort();
	let index;
	let compare;
	for (index = 0; index < projectKeysA.length; index++) {
		compare = projectKeysA[index].localeCompare(projectKeysB[index]);
		if (compare !== 0) {
			return compare;
		}
	}
	for (index = 0; index < projectKeysA.length; index++) {
		compare = projectA[projectKeysA[index]].localeCompare(projectB[projectKeysB[index]]);
		if (compare !== 0) {
			return compare;
		}
	}
	return 0;
}

let projectEquals = (projectA, projectB) => {
	let projectKeysA = Object.keys(projectA);
	let projectKeysB = Object.keys(projectB);
	if (projectKeysA.length !== projectKeysB.length) {
		return false;
	}
	projectKeysA = projectKeysA.sort();
	projectKeysB = projectKeysA.sort();
	let index;
	for (index = 0; index < projectKeysA.length; index++) {
		if (projectKeysA[index] !== projectKeysB[index]) {
			return false;
		}
	}
	for (index = 0; index < projectKeysA.length; index++) {
		if (projectA[projectKeysA[index]] !== projectB[projectKeysB[index]]) {
			return false;
		}
	}
	return true;
}

let projectToString = (project, index) => Object.entries(project).reduce(
	(previousString, currentEntry) => previousString + '\t\t' + currentEntry[0] + ((index === 0) ? 0 : (index || '')) + ' = ' + currentEntry[1] + '\n', ''
);

export {
	compareProjects,
	projectEquals,
	projectToString
}
