Browse Source

Fichier d'acces à la class parser

Loquicom 5 years ago
parent
commit
8e721974b4
1 changed files with 33 additions and 0 deletions
  1. 33 0
      src/parser/index.js

+ 33 - 0
src/parser/index.js

@@ -0,0 +1,33 @@
+const parser = require('./parser');
+
+let instance = null;
+
+module.exports.from = function (path) {
+    if (instance === null) {
+        instance = new parser(path);
+    } else {
+        instance.from(path);
+    }
+    return instance;
+};
+
+module.exports.setup = function (source, dest) {
+    if (instance === null) {
+        instance = new parser(path);
+    } else {
+        instance.from(path);
+    }
+    instance.to(dest);
+    return instance;
+};
+
+module.exports.get = function () {
+    return instance;
+};
+
+module.exports.result = function () {
+    if (instance === null) {
+        return null;
+    }
+    return instance.result;
+};