Files
misskey/packages/backend/src/misc/split-id-and-objects.ts
おさむのひと f6fc78f578 refactor: DriveFileEntityServiceとDriveFolderEntityServiceの複数件取得をリファクタ (#17064)
* refactor: DriveFileEntityServiceとDriveFolderEntityServiceの複数件取得をリファクタ

* add test

* fix

* Update packages/backend/src/core/entities/DriveFolderEntityService.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update packages/backend/test/unit/entities/DriveFolderEntityService.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update packages/backend/src/core/entities/DriveFileEntityService.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Revert "Update packages/backend/src/core/entities/DriveFileEntityService.ts"

This reverts commit 83bb9564cfdb699a21b775815439e1e496cd89a9.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-06 13:13:06 +09:00

28 lines
594 B
TypeScript

/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
/**
* idとオブジェクトを分離する
* @param input idまたはオブジェクトの配列
* @returns idの配列とオブジェクトの配列
*/
export function splitIdAndObjects<T extends { id: string }>(input: (T | string)[]): { ids: string[]; objects: T[] } {
const ids: string[] = [];
const objects : T[] = [];
for (const item of input) {
if (typeof item === 'string') {
ids.push(item);
} else {
objects.push(item);
}
}
return {
ids,
objects,
};
}