some slight cleanup
This commit is contained in:
parent
d0b72fd477
commit
3d99a61ca3
@ -102,6 +102,7 @@ while (rightCursor > 0) {
|
||||
);
|
||||
if (target.index < Infinity && target.index < rightCursor) {
|
||||
// slot exists; move the file, update the array, and update the space lists
|
||||
// but only if the new location is actually to the right of our cursor
|
||||
sparceArray.splice(
|
||||
target.index,
|
||||
fileSize,
|
||||
@ -114,11 +115,9 @@ while (rightCursor > 0) {
|
||||
);
|
||||
spaces[target.size].shift();
|
||||
if (toNum(target.size) - fileSize > 0) {
|
||||
spaces[(toNum(target.size) - fileSize).toString()].unshift(
|
||||
target.index + fileSize
|
||||
);
|
||||
spaces[(toNum(target.size) - fileSize).toString()].sort((a, b) =>
|
||||
a > b ? 1 : -1
|
||||
let newGap = (toNum(target.size) - fileSize).toString();
|
||||
spaces[newGap] = [...spaces[newGap], target.index + fileSize].sort(
|
||||
(a, b) => (a > b ? 1 : -1)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user