mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-08 00:43:54 +00:00
c5870452e3
* remove custom field lowercasing * don't allow custom field form to submit duplicate field * remove unused * update custom field tests * also keep upper case when editing * show key in UI * also kep upper case when creating a new field * fix test * allow old forced case keys to stay as is * allow space * add extension to import * supply initial key to CustomFieldForm * refactor: improve element contrast * refactor: style and composition * consistent use of `customFieldLabelToKey` * fix CopyTag * remove log --------- Co-authored-by: arc-alex <ac@omnivox.dk> Co-authored-by: Carlos Valente <carlosvalente@pm.me>
18 lines
422 B
TypeScript
18 lines
422 B
TypeScript
/**
|
|
* @description Validates a alphanumeric string
|
|
* @returns {boolean}
|
|
*/
|
|
export const isAlphanumeric = (text: string): boolean => {
|
|
const regex = /^[a-z0-9]+$/i;
|
|
return regex.test(text);
|
|
};
|
|
|
|
/**
|
|
* @description Validates a alphanumeric string allow space
|
|
* @returns {boolean}
|
|
*/
|
|
export const isAlphanumericWithSpace = (text: string): boolean => {
|
|
const regex = /^[a-z0-9_ ]+$/i;
|
|
return regex.test(text);
|
|
};
|