Просмотр исходного кода

Utilisation function getExtension de file

Loquicom 5 лет назад
Родитель
Сommit
0c71992157
1 измененных файлов с 1 добавлено и 3 удалено
  1. 1 3
      src/parser/parser.js

+ 1 - 3
src/parser/parser.js

@@ -54,9 +54,7 @@ const parser = class Parser {
         if (!file.exist(source)) {
             throw 'File not found';
         }
-        let split = source.split('/');
-        split = split[split.length - 1].split('.');
-        if (split[split.length - 1] !== 'xml') {
+        if (file.getExtension(source) !== 'xml') {
             throw 'File is not an XML';
         }
         this.source = source;