// getCase.js
/* global AdventureJS A */
/**
* Get the case of a string.
* @method AdventureJS.Game#getCase
* @memberOf AdventureJS
* @param {String} text
* @returns {String}
*/
AdventureJS.FX.getCase = function AdventureJS_getCase(text) {
let CASE = "mixed";
text = text.replace(/\[[^\]]*\]\s*/, "");
if (text === "I") {
CASE = "title";
} else if (text === text.toLowerCase()) {
CASE = "lower";
} else if (text === text.toUpperCase()) {
CASE = "upper";
} else if (
text[0] === text[0].toUpperCase() &&
text.slice(1) === text.slice(1).toLowerCase()
) {
CASE = "title";
}
return CASE;
};