thrownewError(`Must specify an array of alternatives`);
}elseif(alternatives.length<2){
// This doesn't interfere with conditionally-specified alternatives using ternary expressions, because in those cases there is still *some* item specified, it's just going to have a value of `undefined` (and will subsequently be filtered out)
thrownewError("Must specify at least two alternatives");
}elseif(arguments.length>1){
thrownewError(`Only one argument is accepted; maybe you forgot to wrap the different alternatives into an array?`);
// At least one of the alternatives *did* match, but it failed somewhere further down the tree. Chances are that the user intended to match that branch, so we pretend that the other alternatives don't exist, and pass through the original error(s).
returnvalidationResult({errors:nestedErrors});
}else{
letalternativesList=sameLevelErrors
.map((error)=>`"${error.message}"`)
.join(", ");
thrownewValidationError(`Must satisfy at least one of: ${alternativesList}`,{errors:sameLevelErrors});