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