move name validation to a non type specific validator

This commit is contained in:
Sebastian Sdorra
2018-08-08 13:45:27 +02:00
parent 3ff6129b09
commit 378a82244d
6 changed files with 64 additions and 73 deletions

View File

@@ -1,14 +1,8 @@
// @flow
import { isNameValid } from "../../components/validation";
//TODO: How should a group be validated
//TODO: Tests!
const nameRegex = /^([A-z0-9.\-_@]|[^ ]([A-z0-9.\-_@ ]*[A-z0-9.\-_@]|[^\s])?)$/;
export const isNameValid = (name: string) => {
return nameRegex.test(name);
};
export { isNameValid };
export const isMemberNameValid = (name: string) => {
return nameRegex.test(name);
}
return isNameValid(name);
};