Download node_modules/d3-array/src/maxIndex.js from NKessler/Horizon: direct link, hf CLI and curl.
- Browser
- Download file 582 Bytes
-
https://huggingface.co/NKessler/Horizon/resolve/main/node_modules/d3-array/src/maxIndex.js
- Command line
-
hf download hf://NKessler/Horizon/node_modules/d3-array/src/maxIndex.js
-
curl -L -o maxIndex.js https://huggingface.co/NKessler/Horizon/resolve/main/node_modules/d3-array/src/maxIndex.js
582 Bytes
| export default function maxIndex(values, valueof) { | |
| let max; | |
| let maxIndex = -1; | |
| let index = -1; | |
| if (valueof === undefined) { | |
| for (const value of values) { | |
| ++index; | |
| if (value != null | |
| && (max < value || (max === undefined && value >= value))) { | |
| max = value, maxIndex = index; | |
| } | |
| } | |
| } else { | |
| for (let value of values) { | |
| if ((value = valueof(value, ++index, values)) != null | |
| && (max < value || (max === undefined && value >= value))) { | |
| max = value, maxIndex = index; | |
| } | |
| } | |
| } | |
| return maxIndex; | |
| } | |