{"size": 640, "ext": "js", "max_stars_repo_path": "scripts/results.js", "max_stars_repo_name": "BorderKontrol/nodeVoteShirt", "max_stars_repo_stars_event_min_datetime": "2020-06-03T21:06:10.000Z", "max_stars_repo_stars_event_max_datetime": "2020-06-03T21:06:10.000Z", "max_issues_repo_path": "scripts/results.js", "max_issues_repo_name": "BorderKontrol/nodeVoteShirt", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "scripts/results.js", "max_forks_repo_name": "BorderKontrol/nodeVoteShirt", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 20.0, "max_line_length": 55, "alphanum_fraction": 0.5703125}
#!/usr/bin/env node
const nosql = require('nosql');

const workdir = process.cwd();
var db = nosql.load(workdir + '/db.nosql');

var temp = [];
var results = [];
db.find().fields('shirt').callback((err, response) => {
	for (var i=0; i<response.length; i++) {
		if (response[i].shirt) temp.push(response[i].shirt);
	}
	temp = temp.sort();
	results[0] = {
		shirt: temp[0],
		count: 1
	}
	var c = 0;
	for (var i=1; i<temp.length; i++) {
		if (temp[i] == results[c].shirt) results[c].count++
		else {
			c++;
			results[c] = {
				shirt: temp[i],
				count: 1
			}
		}
	}
	results.sort((a, b) => b.count - a.count);
	console.log(results);
});
