Merge pull request #1212 from thecodingmachine/noWhitespaces

FIX: no more whitespaces in player names
This commit is contained in:
Kharhamel 2021-06-21 18:02:07 +02:00 committed by GitHub
commit 5f944d8e4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,7 @@ export interface CharacterTexture {
export const maxUserNameLength: number = MAX_USERNAME_LENGTH; export const maxUserNameLength: number = MAX_USERNAME_LENGTH;
export function isUserNameValid(value: unknown): boolean { export function isUserNameValid(value: unknown): boolean {
return typeof value === "string" && value.length > 0 && value.length <= maxUserNameLength && value.indexOf(' ') === -1; return typeof value === "string" && value.length > 0 && value.length <= maxUserNameLength && /\S/.test(value);
} }
export function areCharacterLayersValid(value: string[] | null): boolean { export function areCharacterLayersValid(value: string[] | null): boolean {