From 642c9ef5e354dbdd9f417d394fcd2e38a8f9e1bc Mon Sep 17 00:00:00 2001 From: Arkerthan <arkerthan@gmail.com> Date: Thu, 25 Apr 2019 11:45:11 +0200 Subject: [PATCH] addA documentation --- devNotes/Useful JS Function Documentation.txt | 2 ++ src/js/utilJS.js | 17 ++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/devNotes/Useful JS Function Documentation.txt b/devNotes/Useful JS Function Documentation.txt index 605ef161e87..eafa5e09cb4 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 784f2aa8812..e1aedf48190 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; -}; -- GitLab