Ver Fonte

Class pour encapsuler resultat du finder

Arthur Brandao há 5 anos atrás
pai
commit
c347cbfb3c
1 ficheiros alterados com 28 adições e 0 exclusões
  1. 28 0
      src/finder/result.js

+ 28 - 0
src/finder/result.js

@@ -0,0 +1,28 @@
+const result = class Result {
+
+    constructor() {
+        this.name = '';
+        this.coAuthors = [];
+        this.formatter = null;
+    }
+
+    setFormatter(formatter) {
+        if (typeof formatter.format === 'function') {
+            this.formatter = formatter;
+        }
+    }
+
+    removeFormatter() {
+        this.formatter = null;
+    }
+
+    toString() {
+        if (this.formatter === null) {
+        } else {
+            return this.formatter.format(this);
+        }
+    }
+
+};
+
+module.exports = result;