@gameye/sdk
Version:
Node.js SDK for Gameye
38 lines • 1.16 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Select a list of active matches.
* @param matchState match state
*/
function selectMatchList(matchState) {
return Object.values(matchState.match).
filter(Boolean).
map(i => i);
}
exports.selectMatchList = selectMatchList;
/**
* Select a list of active matches for a game.
* @param matchState match state
* @param gameKey identifier of the game to select matches for
*/
function selectMatchListForGame(matchState, gameKey) {
return Object.values(matchState.match).
filter(Boolean).
map(i => i).
filter(i => i.gameKey === gameKey);
}
exports.selectMatchListForGame = selectMatchListForGame;
/**
* 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
*/
function selectMatchItem(matchState, matchKey) {
const matchItem = matchState.match[matchKey];
if (!matchItem)
return null;
return matchItem;
}
exports.selectMatchItem = selectMatchItem;
//# sourceMappingURL=match.js.map