From 4f5928c575d55601bf7fc7ae93dbaaa312d4aca1 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 1 Mar 2017 20:35:54 +0900 Subject: [API] Fix bug and extract validator --- src/api/models/user.ts | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/api/models') diff --git a/src/api/models/user.ts b/src/api/models/user.ts index 5246b7c02f..55f8b7faa8 100644 --- a/src/api/models/user.ts +++ b/src/api/models/user.ts @@ -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); } -- cgit v1.2.3-freya