refactor: split common until and add ut

This commit is contained in:
pa
2026-03-04 00:45:40 +09:00
parent dd0293d2a6
commit ea82825823
8 changed files with 315 additions and 173 deletions

View File

@@ -0,0 +1,30 @@
/**
* @param {object} unityPackages
* @returns {{ isPC: boolean, isQuest: boolean, isIos: boolean }}
*/
function getAvailablePlatforms(unityPackages) {
let isPC = false;
let isQuest = false;
let isIos = false;
if (typeof unityPackages === 'object') {
for (const unityPackage of unityPackages) {
if (
unityPackage.variant &&
unityPackage.variant !== 'standard' &&
unityPackage.variant !== 'security'
) {
continue;
}
if (unityPackage.platform === 'standalonewindows') {
isPC = true;
} else if (unityPackage.platform === 'android') {
isQuest = true;
} else if (unityPackage.platform === 'ios') {
isIos = true;
}
}
}
return { isPC, isQuest, isIos };
}
export { getAvailablePlatforms };