Intead of having up be everything above '//Down' - have the enduser write a function 'up' and optionally 'down'. then wrap the script like so below.
The benefit of this is that the script writer can then re-use some logic in the script for both actions.
if(!direction || direction != "up" || direction != "down"){
throw "You need to specify a direction";
}
direction === "up" ? up() : if(down) down();
Intead of having up be everything above '//Down' - have the enduser write a function 'up' and optionally 'down'. then wrap the script like so below.
The benefit of this is that the script writer can then re-use some logic in the script for both actions.