This commit is contained in:
Dragon Fire
2024-03-24 00:45:20 -04:00
parent ee6c27a7ce
commit 3a6c5224ed
3 changed files with 1 additions and 6 deletions
-2
View File
@@ -16,7 +16,6 @@ module.exports = class ArgumentUnionType extends ArgumentType {
async validate(val, msg, arg) {
let results = this.types.map(type => !type.isEmpty(val, msg, arg) && type.validate(val, msg, arg));
results = await Promise.all(results);
console.log(results);
if (results.some(valid => valid && typeof valid !== 'string')) return true;
const errors = results.filter(valid => typeof valid === 'string');
if (errors.length > 0) return errors.join('\n');
@@ -26,7 +25,6 @@ module.exports = class ArgumentUnionType extends ArgumentType {
async parse(val, msg, arg) {
let results = this.types.map(type => !type.isEmpty(val, msg, arg) && type.validate(val, msg, arg));
results = await Promise.all(results);
console.log(results);
for (let i = 0; i < results.length; i++) {
if (results[i] && typeof results[i] !== 'string') return this.types[i].parse(val, msg, arg);
}