const EventEmitter = require('eventemitter2').EventEmitter2;
const STATUS_VALUES = require(`${__dirname}/../constant/Status.js`);

function exists(arr, v) {
    return arr.indexOf(v) !== -1;
}

function add(status, target) {
    status.currents = status.currents.concat([target]);
}

function remove(status, target) {
    status.emit("removed", {
        status: status,
        target: target
    })
    status.currents = status.currents.filter((s) => s !== target);
}

class Status extends EventEmitter {
    constructor(currents) {
        super();
        this.currents = currents || [];
    }

    clear(targetStatus) {
        remove(this, targetStatus);
    }

    dead() {
        add(this, STATUS_VALUES.DEAD);
    }

    has(status) {
        return this.currents.indexOf(status) !== -1;
    }

    isDead() {
        return this.has(STATUS_VALUES.DEAD)
    }
}

module.exports = Status;

@@ -128,106 +128,76 @@
 );%0A%0A
-function exists(arr, v) %7B%0A    return arr.indexOf(v) !== -1;%0A%7D%0A%0Afunction add(status, target
+class Status extends EventEmitter %7B%0A    constructor(currents
 ) %7B%0A    
 stat
@@ -188,29 +188,48 @@
 ents) %7B%0A    
+ 
-statu
+   super();%0A        thi
 s.currents =
@@ -229,31 +229,24 @@
 rents = 
-status.
 currents
 .concat(
@@ -241,68 +241,53 @@
 ents
-.concat(%5Btarget%5D);%0A%7D%0A%0Afunction remove(status, target
+ %7C%7C %5B%5D;%0A    %7D%0A%0A    clear(targetStatus
 ) %7B%0A    
 stat
@@ -282,21 +282,23 @@
 ) %7B%0A    
-statu
+    thi
 s.emit(%22
@@ -321,16 +321,20 @@
     
+    
 status: 
 stat
@@ -329,21 +329,19 @@
 status: 
-statu
+thi
 s,%0A     
@@ -343,16 +343,20 @@
         
+    
 target: 
@@ -365,25 +365,37 @@
 rget
-%0A
+Status%0A  
     
+  
 %7D)%0A    
-statu
+    thi
 s.cu
@@ -403,21 +403,19 @@
 rents = 
-statu
+thi
 s.curren
@@ -447,81 +447,51 @@
 rget
-);%0A%7D%0A%0Aclass Status extends EventEmitter %7B%0A    constructor(current
+Status);%0A    %7D%0A%0A    add(targetStatu
 s) %7B%0A   
     
@@ -486,38 +486,21 @@
 s) %7B%0A   
-  
-   super();%0A
      
-   
 this.cur
@@ -503,32 +503,37 @@
 .currents = 
+this.
 currents
  %7C%7C %5B%5D;%0A    
@@ -524,70 +524,17 @@
 ents
- %7C%7C %5B%5D;%0A    %7D%0A%0A    clear(targetStatus) %7B%0A        remove(this, 
+.concat(%5B
 targ
@@ -533,32 +533,33 @@
 at(%5BtargetStatus
+%5D
 );%0A    %7D%0A%0A    de
@@ -577,18 +577,17 @@
     
-add(this, 
+this.add(
 STAT

Add unused method