From 3e54af55a77919c95ef0b3e1abf78cfdc516018b Mon Sep 17 00:00:00 2001
From: Skriv <skrivelese@gmail.com>
Date: Sat, 9 Mar 2019 01:11:54 +0100
Subject: [PATCH] conversion to template literals

---
 src/js/utilJS.js | 56 ++++++++++++++++++++++++------------------------
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/src/js/utilJS.js b/src/js/utilJS.js
index e570569b0ab..52f617f58e0 100644
--- a/src/js/utilJS.js
+++ b/src/js/utilJS.js
@@ -51,7 +51,7 @@
  *
  * There's also limitHeight which you're not using. It's basically limitMult in different units.
  */
-window.Height = (function(){
+window.Height = (function() {
 	'use strict';
 
 	// Global configuration (for different game modes/options/types)
@@ -139,7 +139,7 @@ window.Height = (function(){
 
 	// Helper method - table lookup for nationality/race combinations
 	const nationalityMeanHeight = function(table, nationality, race, def) {
-		return table[nationality + "." + race] || table[nationality] || table["." + race] || table[""] || def;
+		return table[`${nationality }.${ race}`] || table[nationality] || table[`.${ race}`] || table[""] || def;
 	};
 
 	// Helper method: Generate a skewed normal random variable with the skew s
@@ -240,10 +240,10 @@ window.Height = (function(){
 				result = nationalityMeanHeight(xyMeanHeight, nationality, race) * 1.04;
 				break;
 			case 'Y': case 'Y0': case 'YY': case 'YYY':
-				console.log("Height.mean(): non-viable genes " + genes);
+				console.log(`Height.mean(): non-viable genes ${ genes}`);
 				break;
 			default:
-				console.log("Height.mean(): unknown genes " + genes + ", returning mean between XX and XY");
+				console.log(`Height.mean(): unknown genes ${ genes }, returning mean between XX and XY`);
 				result = nationalityMeanHeight(xxMeanHeight, nationality, race) * 0.5 + nationalityMeanHeight(xyMeanHeight, nationality, race) * 0.5;
 				break;
 		}
@@ -312,7 +312,7 @@ window.Height = (function(){
  *
  *  This was modeled using the Height generator above. For some more information, see the comments for that.
  */
-window.Intelligence = (function(){
+window.Intelligence = (function() {
 	'use strict';
 
 	// Global configuration (for different game modes/options/types)
@@ -486,7 +486,7 @@ window.commaNum = function(s) {
 
 window.cashFormat = function(s) {
 	if (!s) { s = 0; }
-	return "¤" + commaNum(s);
+	return `¤${ commaNum(s)}`;
 };
 
 window.repFormat = function(s) {
@@ -494,11 +494,11 @@ window.repFormat = function(s) {
 	/*if (!s) { s = 0; }*/
 	if (V.cheatMode == 1 || V.debugMode == 1) {
 		if (s > 0) {
-			return "@@.green;" + commaNum(Math.round(s * 100) / 100) + " rep@@";
+			return `@@.green;${ commaNum(Math.round(s * 100) / 100) } rep@@`;
 		} else if (s < 0) {
-			return "@@.red;" + commaNum(Math.round(s * 100) / 100) + " rep@@";
+			return `@@.red;${ commaNum(Math.round(s * 100) / 100) } rep@@`;
 		} else {
-			return commaNum(Math.round(s * 100) / 100) + " rep";
+			return `${commaNum(Math.round(s * 100) / 100) } rep`;
 		}
 	} else {
 		/* In order to calculate just how much any one category matters so we can show a "fuzzy" symbolic value to the player, we need to know how "busy" reputation was this week. To calculate this, I ADD income to expenses. Why? 100 - 100 and 10000 - 10000 BOTH are 0, but a +50 event matters a lot more in the first case than the second. I exclude overflow from the calculation because it's not a "real" expense for our purposes, and divide by half just to make percentages a bit easier. */
@@ -587,16 +587,16 @@ window.massFormat = function(s) {
 	if(s >= 1000) {
 		s = commaNum(Math.trunc(s / 1000));
 		if(s !== 1) {
-			return s+" tons";
+			return `${s} tons`;
 		} else {
-			return s+" ton";
+			return `${s} ton`;
 		}
 	} else {
-	return commaNum(s)+" kg";
+	return `${commaNum(s)} kg`;
 	}
 };
 
-window.isFloat = function(n){
+window.isFloat = function(n) {
 	return n === +n && n !== (n|0);
 };
 
@@ -696,7 +696,7 @@ window.numberToWords = function (x) {
 				if (x > 0) {
 					return string;
 				} else {
-					return "negative " + string;
+					return `negative ${ string}`;
 				}
 			} else {
 				return commaNum(x);
@@ -705,7 +705,7 @@ window.numberToWords = function (x) {
 			if (x > 0) {
 				return string;
 			} else {
-				return "negative " + string;
+				return `negative ${ string}`;
 			}
 		}
 	} else {
@@ -894,7 +894,7 @@ window.cmToInchString = function(s) {
 window.cmToFootInchString = function(s) {
 	if (Math.round(s/2.54) < 12)
 		return cmToInchString(s);
-	return Math.trunc(Math.round(s/2.54)/12) + `'` + Math.round(s/2.54)%12 + `"`;
+	return `${Math.trunc(Math.round(s/2.54)/12) }'${ Math.round(s/2.54)%12 }"`;
 };
 
 //takes a dick value e.g. $activeSlave.dick, returns a string in the format 6 inches
@@ -922,37 +922,37 @@ window.ballsToCM = function(s) {
 //takes a dick value e.g. $activeSlave.dick, returns a string in the format of either `20cm (8 inches)`, `8 inches`, or `20cm`
 window.dickToEitherUnit = function(s) {
 	if (State.variables.showInches === 1)
-		return dickToCM(s) + "cm (" + dickToInchString(s) + ")";
+		return `${dickToCM(s) }cm (${ dickToInchString(s) })`;
 	if (State.variables.showInches === 2)
 		return dickToInchString(s);
-	return dickToCM(s) + "cm";
+	return `${dickToCM(s) }cm`;
 };
 
 //takes a ball value e.g. $activeSlave.balls, returns a string in the format of either `20cm (8 inches)`, `8 inches`, or `20cm`
 window.ballsToEitherUnit = function(s) {
 	if (State.variables.showInches === 1)
-		return ballsToCM(s) + "cm (" + ballsToInchString(s) + ")";
+		return `${ballsToCM(s) }cm (${ ballsToInchString(s) })`;
 	if (State.variables.showInches === 2)
 		return ballsToInchString(s);
-	return ballsToCM(s) + "cm";
+	return `${ballsToCM(s) }cm`;
 };
 
 //takes an int in centimeters e.g. $activeSlave.height, returns a string in the format of either `200cm (6'7")`, `6'7"`, or `200cm`
 window.heightToEitherUnit = function(s) {
 	if (State.variables.showInches === 1)
-		return s + "cm (" + cmToFootInchString(s) + ")";
+		return `${s }cm (${ cmToFootInchString(s) })`;
 	if (State.variables.showInches === 2)
 		return cmToFootInchString(s);
-	return s + "cm";
+	return `${s }cm`;
 };
 
 //takes an int in centimeters e.g. $activeSlave.hLength, returns a string in the format of either `30cm (12 inches)`, `12 inches`, or `30cm`
 window.lengthToEitherUnit = function(s) {
 	if (State.variables.showInches === 1)
-		return s + "cm (" + cmToInchString(s) + ")";
+		return `${s }cm (${ cmToInchString(s) })`;
 	if (State.variables.showInches === 2)
 		return cmToInchString(s);
-	return s + "cm";
+	return `${s }cm`;
 };
 
 /* decoration should be passed as "facilityDecoration" in quotes. For example, ValidateFacilityDecoration("brothelDecoration"). The quotes are important, do not pass it as a story variable. */
@@ -1342,15 +1342,15 @@ window.ordinalSuffix = function ordinalSuffix(i) {
 	var j = i % 10,
 		k = i % 100;
 	if (j === 1 && k !== 11) {
-		return i + "st";
+		return `${i }st`;
 	}
 	if (j === 2 && k !== 12) {
-		return i + "nd";
+		return `${i }nd`;
 	}
 	if (j === 3 && k !== 13) {
-		return i + "rd";
+		return `${i }rd`;
 	}
-	return i + "th";
+	return `${i }th`;
 };
 
 window.removeDuplicates = function removeDuplicates(array) {
-- 
GitLab