modaq
Version:
Quiz Bowl Reader using TypeScript, React, and MobX
19 lines • 875 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createPlayerToColumnMap = void 0;
require("../state/TeamState");
// If we just used a Map<IPlayer, string>, we could run into issues where the serialized player from cycles don't
// match the serialized player in a game. This lets us convert the player's to a unique string without having all the
// places that rely on this map knowing the conversion
function createPlayerToColumnMap() {
const map = new Map();
return {
get: (player) => map.get(getPlayerKey(player)),
set: (player, column) => map.set(getPlayerKey(player), column),
};
}
exports.createPlayerToColumnMap = createPlayerToColumnMap;
function getPlayerKey(player) {
return `${player.teamName.replace(/;/g, ";;")};${player.name}`;
}
//# sourceMappingURL=PlayerToColumnMap.js.map