[API] Fix bug and extract validator

This commit is contained in:
syuilo
2017-03-01 20:35:54 +09:00
parent 4b9067914e
commit 4f5928c575
2 changed files with 7 additions and 3 deletions

View File

@ -15,6 +15,10 @@ export function validatePassword(password: string): boolean {
return typeof password == 'string' && password != '';
}
export function isValidName(name: string): boolean {
return typeof name == 'string' && name.length > 50 && name.trim() != '';
}
export function isValidBirthday(birthday: string): boolean {
return typeof birthday == 'string' && /^([0-9]{4})\-([0-9]{2})-([0-9]{2})$/.test(birthday);
}