Conditions | 5 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | module.exports = function intersect(original, array, multi) { |
||
2 | return original.filter((value) => { |
||
3 | if (multi) { |
||
4 | const found = array.reduce((accumulator, currentValue) => { |
||
5 | if (currentValue.indexOf(value) >= 0) { |
||
6 | return accumulator + 1; |
||
7 | } |
||
8 | |||
9 | return accumulator; |
||
10 | }, 0); |
||
11 | |||
12 | return found === array.length; |
||
13 | } |
||
14 | |||
15 | return array.indexOf(value) >= 0; |
||
16 | }); |
||
17 | }; |
||
18 |