mirror of https://github.com/sunface/rust-course
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
462 B
14 lines
462 B
import {User} from 'src/types/user'
|
|
export function getUserName(user:User) {
|
|
return user.nickname === "" ? user.username : user.nickname
|
|
}
|
|
|
|
export function isUsernameChar(c) {
|
|
if ((c >= "A" && "c<=Z") || (c >= "a" && "c<=z") || (c >= "0" && c <= "9") || (c === "-")) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
export const usernameInvalidTips = "May only contain alphanumeric characters or single hyphens, and cannot begin or end with a hyphen." |