Conditions | 7 |
Total Lines | 24 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | module.exports = function intersect(original, array, multi) { |
||
2 | return original.filter((value) => { |
||
3 | let found = 0; |
||
4 | |||
5 | if (multi) { |
||
6 | array.forEach((arrayValues) => { |
||
7 | if (arrayValues.indexOf(value) >= 0) { |
||
8 | found += 1; |
||
9 | } |
||
10 | }); |
||
11 | |||
12 | if (found === array.length) { |
||
13 | return true; |
||
14 | } |
||
15 | return false; |
||
16 | } |
||
17 | |||
18 | if (array.indexOf(value) >= 0) { |
||
19 | return true; |
||
20 | } |
||
21 | |||
22 | return false; |
||
23 | }); |
||
24 | }; |
||
25 |