Преглед изворни кода

Utilisation function getExtension de file

Loquicom пре 5 година
родитељ
комит
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;