{"size": 1430, "ext": "js", "max_stars_repo_path": "js/core/utils.js", "max_stars_repo_name": "knispeja/WitnessGenerator", "max_stars_repo_stars_event_min_datetime": "2019-05-06T02:25:14.000Z", "max_stars_repo_stars_event_max_datetime": "2019-05-06T02:25:14.000Z", "max_issues_repo_path": "js/core/utils.js", "max_issues_repo_name": "knispeja/WitnessGenerator", "max_issues_repo_issues_event_min_datetime": "2019-06-21T19:46:58.000Z", "max_issues_repo_issues_event_max_datetime": "2019-08-24T07:03:59.000Z", "max_forks_repo_path": "js/core/utils.js", "max_forks_repo_name": "knispeja/WitnessGenerator", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": 21, "max_forks_count": null, "avg_line_length": 27.5, "max_line_length": 79, "alphanum_fraction": 0.6251748252}
function stringToBoolean(str, default_value) {
    if (str == undefined || str == null) {
        return default_value;
    }

    var normalized = str.toLowerCase().trim();
    if (normalized == 'true' || normalized == '1') {
        return true;
    }
    else if (normalized == 'false' || normalized == '0') {
        return false;
    }
    return default_value;
}

// Await this method to sleep
function sleep(time_ms) {
	return new Promise((resolve) => setTimeout(resolve, time_ms));
}

// Gets JSON object from given URL (or current URL by default)
// The properties of the object will be the parameters on the URL
function getJsonFromUrl(url) {
	if (!url) {
		url = location.search;
	}
	var query = url.substr(1);
	var result = {};
	query.split("&").forEach(function(part) {
		var item = part.split("=");
		result[item[0]] = decodeURIComponent(item[1]);
	});
	return result;
}

// Adds a URL parameter to the current URL without reloading the page
function addUrlParameter(key, value) {
    var temp_url_params = location.search;
    if (temp_url_params.length > 0) {
        temp_url_params += "&";
    }
    else {
        temp_url_params += "?";
    }

    var encoded_value = encodeURIComponent(value);
	temp_url_params += `${key}=${encoded_value}`;
	
	url_params[key] = encoded_value;
    history.pushState(null, null, window.location.pathname + temp_url_params);
}
