Added more error-handling to ToUpperCase()

This commit is contained in:
Michael Rowley 2021-12-29 19:59:48 +00:00
parent 2574a63975
commit ed542582f9
1 changed files with 3 additions and 0 deletions

View File

@ -37,6 +37,9 @@ class ToUpperCase extends Operation {
* @returns {string}
*/
run(input, args) {
if (!args || args.length === 0) {
throw new OperationException("No capitalization scope was provided.");
}
const scope = args[0];
if (scope === "All") {
return input.toUpperCase();