소스 검색

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;