(values, valueof)
| 1 | export default function maxIndex(values, valueof) { |
| 2 | let max; |
| 3 | let maxIndex = -1; |
| 4 | let index = -1; |
| 5 | if (valueof === undefined) { |
| 6 | for (const value of values) { |
| 7 | ++index; |
| 8 | if (value != null |
| 9 | && (max < value || (max === undefined && value >= value))) { |
| 10 | max = value, maxIndex = index; |
| 11 | } |
| 12 | } |
| 13 | } else { |
| 14 | for (let value of values) { |
| 15 | if ((value = valueof(value, ++index, values)) != null |
| 16 | && (max < value || (max === undefined && value >= value))) { |
| 17 | max = value, maxIndex = index; |
| 18 | } |
| 19 | } |
| 20 | } |
| 21 | return maxIndex; |
| 22 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…