Guest User

Untitled

a guest
Dec 15th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. const queries = {
  2. getRoom(state: State, roomID: string) {
  3. return state.rooms[roomID]
  4. },
  5. isPlayerInRoom(state: State, roomID: string) {
  6. return state.player.roomID === roomID
  7. }
  8. }
  9.  
  10. const newQueries = {}
  11. for (const [name, func] = Object.entries(queries)) {
  12. newQueries[name] = (...args) => func(store.getState(), ...args)
  13. }
  14. ...
  15. newQueries.getRoom(5)
Add Comment
Please, Sign In to add comment