| Conditions | 5 |
| Paths | 6 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | /** |
||
| 13 | this.visible = function(items, func, currentElement, sortFunc) { |
||
| 14 | let visibles = []; |
||
| 15 | for (let i in items) { |
||
| 16 | // if it is an array, we need to extract the item from the index |
||
| 17 | let item = Array.isArray(items) ? items[i] : i; |
||
| 18 | if (func(item, currentElement)) { |
||
| 19 | visibles.push(item); |
||
| 20 | } |
||
| 21 | } |
||
| 22 | if(sortFunc){ |
||
| 23 | visibles.sort(sortFunc); |
||
| 24 | } |
||
| 25 | return visibles; |
||
| 26 | }; |
||
| 27 | |||
| 54 |