Download node_modules/d3-array/src/minIndex.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/minIndex.js
- Command line
-
hf download hf://NKessler/Horizon/node_modules/d3-array/src/minIndex.js
-
curl -L -o minIndex.js https://huggingface.co/NKessler/Horizon/resolve/main/node_modules/d3-array/src/minIndex.js
582 Bytes
| export default function minIndex(values, valueof) { | |
| let min; | |
| let minIndex = -1; | |
| let index = -1; | |
| if (valueof === undefined) { | |
| for (const value of values) { | |
| ++index; | |
| if (value != null | |
| && (min > value || (min === undefined && value >= value))) { | |
| min = value, minIndex = index; | |
| } | |
| } | |
| } else { | |
| for (let value of values) { | |
| if ((value = valueof(value, ++index, values)) != null | |
| && (min > value || (min === undefined && value >= value))) { | |
| min = value, minIndex = index; | |
| } | |
| } | |
| } | |
| return minIndex; | |
| } | |