UNPKG

rune

Version:

CLI to upload your games to Rune

18 lines (17 loc) 550 B
export function getMyGames({ games, devId, } = {}) { if (!devId || !games) { return { myGames: undefined, otherGames: undefined }; } const sortedGames = [...games].sort((g1, g2) => g1.title.localeCompare(g2.title)); const myGames = []; const otherGames = []; for (const game of sortedGames) { if (game.gameDevs.nodes.some((gameDev) => gameDev.userId === devId)) { myGames.push(game); } else { otherGames.push(game); } } return { myGames, otherGames }; }