@gameye/sdk
Version:
Node.js SDK for Gameye
33 lines • 964 B
JavaScript
/**
* Select a list of active matches.
* @param matchState match state
*/
export function selectMatchList(matchState) {
return Object.values(matchState.match).
filter(Boolean).
map(i => i);
}
/**
* Select a list of active matches for a game.
* @param matchState match state
* @param gameKey identifier of the game to select matches for
*/
export function selectMatchListForGame(matchState, gameKey) {
return Object.values(matchState.match).
filter(Boolean).
map(i => i).
filter(i => i.gameKey === gameKey);
}
/**
* Get details about a single match from a match-state as returned by
* the gameye api.
* @param matchState match state
* @param matchKey identifier of the match to get the details for
*/
export function selectMatchItem(matchState, matchKey) {
const matchItem = matchState.match[matchKey];
if (!matchItem)
return null;
return matchItem;
}
//# sourceMappingURL=match.js.map