- typeof input.type === 'object' &&
- input.type.type === 'array'
- ? input.type.items === type
- : false;
+ input.type instanceof Array
+ ? (input.type.filter(t => typeof t === 'object' &&
+ t.type === 'array' &&
+ t.items === type).length > 0)
+ : (typeof input.type === 'object' &&
+ input.type.type === 'array' &&
+ input.type.items === type);
+
+export const getEnumType = (input: GenericCommandInputParameter<any, any>) => {
+ if (input.type instanceof Array) {
+ const f = input.type.filter(t => typeof t === 'object' &&
+ !(t instanceof Array) &&
+ t.type === 'enum');
+ if (f.length > 0) {
+ return f[0];
+ }
+ } else {
+ if ((typeof input.type === 'object' &&
+ !(input.type instanceof Array) &&
+ input.type.type === 'enum')) {
+ return input.type;
+ }
+ }
+ return null;
+};