diff options
| author | おさむのひと <46447427+samunohito@users.noreply.github.com> | 2026-01-06 13:13:06 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-06 13:13:06 +0900 |
| commit | f6fc78f578c344172349f7795b168b2992953bd0 (patch) | |
| tree | 0eaf040b161ac525460b6a7359c149b787263a16 /packages/backend/src/misc/split-id-and-objects.ts | |
| parent | update clean scripts (diff) | |
| download | misskey-f6fc78f578c344172349f7795b168b2992953bd0.tar.gz misskey-f6fc78f578c344172349f7795b168b2992953bd0.tar.bz2 misskey-f6fc78f578c344172349f7795b168b2992953bd0.zip | |
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>
Diffstat (limited to 'packages/backend/src/misc/split-id-and-objects.ts')
| -rw-r--r-- | packages/backend/src/misc/split-id-and-objects.ts | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/packages/backend/src/misc/split-id-and-objects.ts b/packages/backend/src/misc/split-id-and-objects.ts new file mode 100644 index 0000000000..d23bb93695 --- /dev/null +++ b/packages/backend/src/misc/split-id-and-objects.ts @@ -0,0 +1,27 @@ +/* + * 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, + }; +} |