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}.`); }