From ebb1facd682a9305fe1244e64f53e2753ea8810d Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sun, 24 Mar 2024 00:35:44 -0400 Subject: [PATCH] Really don't get it --- framework/UnionType.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/framework/UnionType.js b/framework/UnionType.js index 3c136155..1441f97f 100644 --- a/framework/UnionType.js +++ b/framework/UnionType.js @@ -16,6 +16,7 @@ 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'); @@ -25,9 +26,9 @@ 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); - console.log(results[i], typeof results[i]); } throw new Error(`Couldn't parse value "${val}" with union type ${this.id}.`); }