2018-08-02 16:09:58 +02:00
|
|
|
// @flow
|
2018-09-05 14:32:49 +02:00
|
|
|
import { validation } from "@scm-manager/ui-components";
|
2018-08-02 16:09:58 +02:00
|
|
|
|
2019-03-12 17:07:14 +01:00
|
|
|
const nameRegex = /(?!^\.\.$)(?!^\.$)(?!.*[\\\[\]])^[A-Za-z0-9\.][A-Za-z0-9\.\-_]*$/;
|
2019-03-12 15:10:05 +01:00
|
|
|
|
2018-08-02 16:09:58 +02:00
|
|
|
export const isNameValid = (name: string) => {
|
2019-03-12 15:10:05 +01:00
|
|
|
return nameRegex.test(name);
|
2018-08-02 16:09:58 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export function isContactValid(mail: string) {
|
2018-09-05 14:32:49 +02:00
|
|
|
return "" === mail || validation.isMailValid(mail);
|
2018-08-02 16:09:58 +02:00
|
|
|
}
|