UNPKG

@gameye/sdk

Version:
48 lines 1.54 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * List all players in the match. * @param statisticState statistic state */ function selectPlayerList(statisticState) { const playerIndex = statisticState.statistic.player; if (!playerIndex) return []; return Object.values(playerIndex); } exports.selectPlayerList = selectPlayerList; /** * Get a list if all players in a team. * @param statisticState statistic state * @param teamKey identifier of the team */ function selectPlayerListForTeam(statisticState, teamKey) { const teamIndex = statisticState.statistic.team; if (!teamIndex) return []; if (!teamIndex[teamKey]) return []; const playerIndex = statisticState.statistic.player; if (!playerIndex) return []; return Object.entries(teamIndex[teamKey].player). filter(([, playerEnabled]) => playerEnabled). map(([playerKey]) => playerIndex[playerKey]); } exports.selectPlayerListForTeam = selectPlayerListForTeam; /** * Get a single player in the match. * @param statisticState statistic state * @param playerKey identifier of the player to get the details for */ function selectPlayerItem(statisticState, playerKey) { const playerIndex = statisticState.statistic.player; if (!playerIndex) return null; const playerItem = playerIndex[playerKey]; if (!playerItem) return null; return playerItem; } exports.selectPlayerItem = selectPlayerItem; //# sourceMappingURL=player.js.map