Fixes #4943 ## How was it tested? Local (front + /metadata) Unit tests for utils --------- Co-authored-by: Weiko <corentin@twenty.com>
10 lines
314 B
TypeScript
10 lines
314 B
TypeScript
import { InvalidStringException } from 'src/engine/metadata-modules/errors/InvalidStringException';
|
|
|
|
const VALID_STRING_PATTERN = /^[a-zA-Z][a-zA-Z0-9 ]*$/;
|
|
|
|
export const validateMetadataName = (string: string) => {
|
|
if (!string.match(VALID_STRING_PATTERN)) {
|
|
throw new InvalidStringException(string);
|
|
}
|
|
};
|