Skip to content

Instantly share code, notes, and snippets.

@hugomd
Last active May 23, 2018 11:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hugomd/7467538c54a041cd3d336bf28a02c144 to your computer and use it in GitHub Desktop.
Save hugomd/7467538c54a041cd3d336bf28a02c144 to your computer and use it in GitHub Desktop.
availableRooms.forEach((room, index) => {
console.log(`${index} - ${room.name}`)
})
+ const roomSchema = [
+ {
+ description: 'Select a room',
+ name: 'room',
+ conform: v => {
+ if (v >= availableRooms.length) {
+ return false
+ }
+ return true
+ },
+ message: 'Room must only be numbers',
+ required: true
+ }
+ ]
+ const { room: chosenRoom } = await get(roomSchema)
+ const room = availableRooms[chosenRoom]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment