(current, candidate)
| 121 | // RANK is the comparison ordinal: GREEN(0) < YELLOW(1) < RED(2). |
| 122 | const RANK = { GREEN: 0, YELLOW: 1, RED: 2 }; |
| 123 | function escalate(current, candidate) { |
| 124 | return RANK[candidate] > RANK[current] ? candidate : current; |
| 125 | } |
| 126 | let gate = 'GREEN'; |
| 127 | if (rows.length === 0) gate = 'RED'; |
| 128 | else { |