<commit_before>// resistance.js
// That thing.

var resistance = {};

resistance.test = function () {
}<commit_msg>Added the pretty print function<commit_after>// resistance.js
// That thing.

var resistance = {};

/**
 * Calculate the resistance based on a array of strings with the band colors.
 *
 * @param {Array} bands Band name colors.
 * @return {Number} Resistance
 */
resistance.calc = function (bands) {
	var resistance = 0;

	// TODO: Calculate?

	return resistance;
}

/**
 * Pretty-print a resistance value.
 *
 * @param {String} value Resistance value.
 * @param {Boolean} use_symbol Use ohms symbol?
 * @return {String} Pretty-printed value.
 */
resistance.pretty_print = function (value, use_symbol) {
	var result = "";

	if (value >= 1000000) {
		result = (value / 1000000) + "M";
	} else if (value >= 1000) {
		result = (value / 1000) + "k";
	} else {
		result += value;
	}

	if (use_symbol || use_symbol === undefined) {
		result += "\u2126";
	} else {
		result += " ohms";
	}

	return result;
}
{'fraction_non_alphanumeric': 0.15187376725838264, 'fraction_numerical': 0.026627218934911243, 'mean_word_length': 3.3376068376068377, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '299997', 'n_tokens_mistral': 363, 'n_tokens_neox': 317, 'n_words': 104}