Explorar o código

Utilisation function getExtension de file

Loquicom %!s(int64=5) %!d(string=hai) anos
pai
achega
0c71992157
Modificáronse 1 ficheiros con 1 adicións e 3 borrados
  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;