boardgame.io
Version:
library for turn-based games
37 lines (34 loc) • 940 B
JavaScript
export { v as ActivePlayers, h as INVALID_MOVE, S as Stage, T as TurnOrder } from './turn-order-dce10a02.js';
import 'immer';
/*
* Copyright 2018 The boardgame.io Authors
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
*/
/**
* PlayerView reducers.
*/
const PlayerView = {
/**
* STRIP_SECRETS
*
* Reducer which removes a key named `secret` and
* removes all the keys in `players`, except for the one
* corresponding to the current playerID.
*/
STRIP_SECRETS: (G, ctx, playerID) => {
let r = { ...G };
if (r.secret !== undefined) {
delete r.secret;
}
if (r.players) {
r.players = {
[playerID]: r.players[playerID],
};
}
return r;
},
};
export { PlayerView };