Revert "refactor: 可読性のため一部でArray.prototype.atを使うように" (#115)

* Revert "refactor: 可読性のため一部で`Array.prototype.at`を使うように (#11274)"

This reverts commit 2b6dbd4fcb.

* Apply suggestions from code review

---------

Co-authored-by: okayurisotto <okayurisotto@proton.me>
This commit is contained in:
まっちゃとーにゅ
2023-07-25 19:58:08 +09:00
committed by GitHub
parent 3bde1b398a
commit 1e6389d990
19 changed files with 36 additions and 38 deletions

View File

@@ -568,7 +568,7 @@ function fetchMoreFolders() {
os.api('drive/folders', {
folderId: folder.value ? folder.value.id : null,
type: props.type,
untilId: folders.value.at(-1)?.id,
untilId: folders.value[folders.value.length - 1].id,
limit: max + 1,
}).then(folders => {
if (folders.length === max + 1) {
@@ -591,7 +591,7 @@ function fetchMoreFiles() {
os.api('drive/files', {
folderId: folder.value ? folder.value.id : null,
type: props.type,
untilId: files.value.at(-1)?.id,
untilId: files.value[files.value.length - 1].id,
limit: max + 1,
}).then(files => {
if (files.length === max + 1) {

View File

@@ -59,8 +59,8 @@ function draw(): void {
polygonPoints = `0,${ viewBoxY } ${ polylinePoints } ${ viewBoxX },${ viewBoxY }`;
headX = _polylinePoints.at(-1)![0];
headY = _polylinePoints.at(-1)![1];
headX = _polylinePoints[_polylinePoints.length - 1][0];
headY = _polylinePoints[_polylinePoints.length - 1][1];
}
watch(() => props.src, draw, { immediate: true });

View File

@@ -120,7 +120,7 @@ const contextmenu = $computed(() => ([{
function back() {
history.pop();
router.replace(history.at(-1)!.path, history.at(-1)!.key);
router.replace(history[history.length - 1].path, history[history.length - 1].key);
}
function reload() {

View File

@@ -233,7 +233,7 @@ const fetchMore = async (): Promise<void> => {
...(props.pagination.offsetMode ? {
offset: offset.value,
} : {
untilId: Array.from(items.value.keys()).at(-1),
untilId: Array.from(items.value.keys())[items.value.size - 1],
}),
}).then(res => {
for (let i = 0; i < res.length; i++) {
@@ -297,7 +297,7 @@ const fetchMoreAhead = async (): Promise<void> => {
...(props.pagination.offsetMode ? {
offset: offset.value,
} : {
sinceId: Array.from(items.value.keys()).at(-1),
sinceId: Array.from(items.value.keys())[items.value.size - 1],
}),
}).then(res => {
if (res.length === 0) {