validateId.ts 140 B

1234
  1. export const validateId = (id: string): boolean => {
  2. // Allow empty ids
  3. return !id || /^[A-Za-z0-9]+(?:[ _-][A-Za-z0-9]+)*$/.test(id);
  4. };