cal/packages/lib/getValidRhfFieldName.ts
Hariom Balhara 51caa6834a
fix: Make identifier conform to RHF field requirement (#10860)
Co-authored-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
2023-08-21 13:11:47 -04:00

6 lines
412 B
TypeScript

export const getValidRhfFieldName = (fieldName: string) => {
// Remember that any transformation that you do here would run on System Field names as well. So, be careful and avoiding doing anything here that would modify the SystemField names.
// e.g. SystemField name currently have uppercases in them. So, no need to lowercase unless absolutely needed.
return fieldName.replace(/[^a-zA-Z0-9]/g, "-");
};