nit: Use spaces between `?` and `:` in ternary expressions... Also, this line looks rather long and may need broken down to pass jslint