Completed
Push — master ( b8c0d7...8cf4a8 )
by Pieter Epeüs
21s queued 10s
created

src/modules/diff.js   A

Complexity

Total Complexity 4
Complexity/F 1.33

Size

Lines of Code 14
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 8
mnd 1
bc 1
fnc 3
dl 0
loc 14
rs 10
bpm 0.3333
cpm 1.3333
noi 0
c 0
b 0
f 0
1
module.exports = function diff(currentArray, otherArray, total) {
2
    const differenceArray = currentArray.filter(
3
        (value) => otherArray.indexOf(value) < 0
4
    );
5
    let differenceArrayB = [];
6
7
    if (total) {
8
        differenceArrayB = otherArray.filter(
9
            (value) => currentArray.indexOf(value) < 0
10
        );
11
    }
12
13
    return differenceArray.concat(differenceArrayB);
14
};
15