ktongue's picture
download
raw
467 Bytes
import ascending from "./ascending.js";
import minIndex from "./minIndex.js";
export default function leastIndex(values, compare = ascending) {
if (compare.length === 1) return minIndex(values, compare);
let minValue;
let min = -1;
let index = -1;
for (const value of values) {
++index;
if (min < 0
? compare(value, value) === 0
: compare(value, minValue) < 0) {
minValue = value;
min = index;
}
}
return min;
}

Xet Storage Details

Size:
467 Bytes
·
Xet hash:
dc9a39623e27bca96f50c1786cc6de3ccf899623ad4b038851a36c96adb17b3c

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.