Pārlūkot izejas kodu

Adaptation aux modifications de la class formatter

Arthur Brandao 5 gadi atpakaļ
vecāks
revīzija
7be3a1f37e
2 mainītis faili ar 8 papildinājumiem un 5 dzēšanām
  1. 1 1
      main.js
  2. 7 4
      src/finder/index.js

+ 1 - 1
main.js

@@ -116,6 +116,6 @@ function find(source, name) {
             timer.stop();
             console.info(`${name}'s co-authors find in ${timer.time()}`);
         }
-        console.info(finder.toString(name, result));
+        console.info(finder.print(result));
     });
 }

+ 7 - 4
src/finder/index.js

@@ -1,5 +1,6 @@
 const finder = require('./finder').get();
-const formatter = require('./formatter');
+let formatter = require('./formatter');
+formatter = new formatter();
 
 module.exports.in = function (path) {
     return finder.from(path);
@@ -9,7 +10,9 @@ module.exports.get = function () {
     return finder;
 };
 
-module.exports.toString = function (name, result) {
-    const f = new formatter(name, result);
-    return f.toString();
+module.exports.result = finder.result;
+
+module.exports.print = function (result) {
+    result.setFormatter(formatter);
+    return result.toString();
 };