瀏覽代碼

Class pour encapsuler resultat du finder

Arthur Brandao 5 年之前
父節點
當前提交
c347cbfb3c
共有 1 個文件被更改,包括 28 次插入0 次删除
  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;