ktongue's picture
download
raw
470 Bytes
import ascending from "./ascending.js";
import maxIndex from "./maxIndex.js";
export default function greatestIndex(values, compare = ascending) {
if (compare.length === 1) return maxIndex(values, compare);
let maxValue;
let max = -1;
let index = -1;
for (const value of values) {
++index;
if (max < 0
? compare(value, value) === 0
: compare(value, maxValue) > 0) {
maxValue = value;
max = index;
}
}
return max;
}

Xet Storage Details

Size:
470 Bytes
·
Xet hash:
4be10ca38d89fdbdb20b31dab77b13e0d95388fe7d11e42e75a6ff93cde1dd96

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