export const DIVISION_NAME_MAX_LENGTH = 64; export const DIVISION_CODE_MAX_LENGTH = 16; /** Letters with single spaces between words. */ export const DIVISION_NAME_PATTERN = /^[A-Za-z]+(?: [A-Za-z]+)*$/; /** Alphanumeric and underscore; no spaces. */ export const DIVISION_CODE_PATTERN = /^[A-Za-z0-9_]+$/; export function isValidDivisionName(raw: string): boolean { return ( typeof raw === 'string' && raw.length > 0 && raw.length <= DIVISION_NAME_MAX_LENGTH && DIVISION_NAME_PATTERN.test(raw) ); } export function isValidDivisionCode(raw: string): boolean { return ( typeof raw === 'string' && raw.length > 0 && raw.length <= DIVISION_CODE_MAX_LENGTH && DIVISION_CODE_PATTERN.test(raw) ); }