(levels, currentIndex)
| 988 | } |
| 989 | |
| 990 | const findFirstIncompleteLevelOfPreviousPracticeChain = function (levels, currentIndex) { |
| 991 | let index = skipNonPracticeLevels(levels, currentIndex - 1) |
| 992 | |
| 993 | if (index >= 0) { |
| 994 | index = skipPracticeLevels(levels, index) |
| 995 | |
| 996 | if (index >= 0) { |
| 997 | index++ |
| 998 | |
| 999 | // Skip completed practice levels |
| 1000 | while ((index < levels.length) && isPractice(levels[index]) && levels[index].complete) { index++ } |
| 1001 | |
| 1002 | if (isLocked(levels[index])) { return -1 } |
| 1003 | if (isPractice(levels[index]) && !levels[index].complete) { return index } |
| 1004 | } |
| 1005 | } |
| 1006 | |
| 1007 | return -1 |
| 1008 | } |
| 1009 | |
| 1010 | const isAnyPrecedingLevelLocked = function (levels, currentIndex) { |
| 1011 | for (let i = 0, end = currentIndex, asc = end >= 0; asc ? i <= end : i >= end; asc ? i++ : i--) { |
no test coverage detected