@visactor/vtable
Version:
canvas table width high performance
13 lines (11 loc) • 419 B
JavaScript
function createArray(get, length) {
const array = new Array(length);
for (let i = 0; i < length; i++) array[i] = get(i);
return array;
}
export function sort(get, set, length, compare, order, getField) {
const old = createArray(get, length);
old.sort(((r1, r2) => compare(getField(r1), getField(r2), order)));
for (let i = 0; i < length; i++) set(i, old[i]);
}
//# sourceMappingURL=sort.js.map