master
 1Vue.component "registration",
 2  props: ['usernames']
 3  data: () ->
 4    terms_and_conditions: ''
 5    email: ''
 6    password: ''
 7    username: ''
 8
 9  computed:
10    validation: ->
11      username: @username.length > 0 && @usernameAvailable()
12      email: @email.length > 0
13      password: @password.length > 0
14      terms_and_conditions: @terms_and_conditions
15
16    isValid: ->
17      validation = @validation
18      Object.keys(validation).every (key) =>
19        validation[key]
20
21  methods:
22    usernameAvailable: ->
23      !@usernames.includes(@username)