diff --git a/devNotes/Useful JS Function Documentation.txt b/devNotes/Useful JS Function Documentation.txt index 605ef161e877a5c0c4b70e60ac2030926c365478..eafa5e09cb42a6b481885d0b473e616fa15279bc 100644 --- a/devNotes/Useful JS Function Documentation.txt +++ b/devNotes/Useful JS Function Documentation.txt @@ -340,6 +340,8 @@ UtilJS [script] capFirstChar() - Capitalizes the first character of a given string. + addA() - Adds an `a ` or, if the first character is a vocal, an `an ` in front of a given string. + cmToInchString() - takes an integer e.g. $activeSlave.hLength, returns a string in the format 10 inches cmToFootInchString() - takes an integer e.g. $activeSlave.height, returns a string in the format 6'5" diff --git a/src/js/utilJS.js b/src/js/utilJS.js index 784f2aa881229e64ed4bf7d6c5d4da37c1675d48..e1aedf481903270dbd76020ca1de52cdaf9ca9a6 100644 --- a/src/js/utilJS.js +++ b/src/js/utilJS.js @@ -850,6 +850,14 @@ window.capFirstChar = function capFirstChar(string) { return string.charAt(0).toUpperCase() + string.substr(1); }; +window.addA = function(word) { + let vocal = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']; + if (vocal.includes(word.charAt(0))) { + return "an " + word; + } + return "a " + word; +}; + window.getSlaveDevotionClass = /** @param {App.Entity.SlaveState} slave */ function(slave) { if ((!slave) || (!State)) { return undefined; @@ -1732,12 +1740,3 @@ App.Utils.slaveRefString = function(i) { App.Utils.slaveByIndex = function(i) { return i === -1 ? State.variables.activeSlave : State.variables.slaves[i]; }; - - -window.addA = function(word) { - let vocal = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']; - if (vocal.includes(word.charAt(0))) { - return "an " + word; - } - return "a " + word; -};