diff options
author | jbion <joffrey.bion@amadeus.com> | 2017-05-12 13:56:52 +0200 |
---|---|---|
committer | jbion <joffrey.bion@amadeus.com> | 2017-05-12 13:56:52 +0200 |
commit | 33184b9de4d968af859a101dbe097ea18a092225 (patch) | |
tree | 11a2c34528cd43fbcbf2ff162777e526db34d9ec /frontend/src/redux/players.js | |
parent | Fix getGame which needs to use a string instead of int key (diff) | |
download | seven-wonders-33184b9de4d968af859a101dbe097ea18a092225.tar.gz seven-wonders-33184b9de4d968af859a101dbe097ea18a092225.tar.bz2 seven-wonders-33184b9de4d968af859a101dbe097ea18a092225.zip |
Fix getPlayers that in fact takes an immutable List instead of JS array
Diffstat (limited to 'frontend/src/redux/players.js')
-rw-r--r-- | frontend/src/redux/players.js | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/frontend/src/redux/players.js b/frontend/src/redux/players.js index 85b5d042..09f7390b 100644 --- a/frontend/src/redux/players.js +++ b/frontend/src/redux/players.js @@ -1,4 +1,4 @@ -import {fromJS, Map, Set} from 'immutable' +import { fromJS, Map } from 'immutable' export const types = { REQUEST_CHOOSE_USERNAME: 'USER/REQUEST_CHOOSE_USERNAME', @@ -41,14 +41,10 @@ export default (state = initialState, action) => { const getState = globalState => globalState.get('players') -function keyIn(...keys) { - return (v, k) => Set(keys).has(k) -} - export const getAllPlayersByUsername = globalState => getState(globalState).get('all') export const getAllPlayers = globalState => getAllPlayersByUsername(globalState).toList() export const getPlayers = (globalState, usernames) => getAllPlayersByUsername(globalState) - .filter(keyIn(usernames)) + .filter((v, k) => usernames.contains(k)) .toList() export const getCurrentPlayerUsername = globalState => getState(globalState).get('current') export const getCurrentPlayer = globalState => getAllPlayersByUsername(globalState) |