In the example, you are only matching with the 'docx' extension, maybe encapsulating your code in a for loop that checks for all needed examples can be a solution:
let found = False;
for (ext in ["docx", "doc", "txt"]) {
if (this.fileExtension.toLowerCase().match(ext)) {
found = True;
break;
}
}
// work your magic with the found variable...
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…