Fix bug
This commit is contained in:
parent
48812ad2e0
commit
abfb36bcdb
4 changed files with 32 additions and 4 deletions
|
|
@ -8,9 +8,14 @@ const collection = db.get('users');
|
|||
export default collection as any; // fuck type definition
|
||||
|
||||
export function validateUsername(username: string): boolean {
|
||||
return /^[a-zA-Z0-9\-]{3,20}$/.test(username);
|
||||
return typeof username == 'string' && /^[a-zA-Z0-9\-]{3,20}$/.test(username);
|
||||
}
|
||||
|
||||
export function validatePassword(password: string): boolean {
|
||||
return typeof password == 'string' && password != '';
|
||||
}
|
||||
|
||||
export function isValidBirthday(birthday: string): boolean {
|
||||
return /^([0-9]{4})\-([0-9]{2})-([0-9]{2})$/.test(birthday);
|
||||
return typeof birthday == 'string' && /^([0-9]{4})\-([0-9]{2})-([0-9]{2})$/.test(birthday);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue