Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private handleFreeForm(field: Ro.IField, fieldEntry: string) {
if (field.isScalar()) {
const mandatoryError = validateMandatory(field, fieldEntry);
if (mandatoryError) {
return this.returnResult('', this.validationMessage(mandatoryError, new Ro.Value(''), field.extensions().friendlyName()));
}
let value = new Ro.Value(fieldEntry);
if (Ro.isDateOrDateTime(field)) {
const dt = validateDate(fieldEntry, supportedDateFormats);
if (dt) {
value = new Ro.Value(Ro.toDateString(dt.toDate()));
}
}
// if optional but empty always valid
if (fieldEntry != null && fieldEntry !== '') {
const remoteMask = field.extensions().mask();
const localFilter = this.mask.toLocalFilter(remoteMask, field.extensions().format()!);
const validateError = validateMandatoryAgainstType(field, fieldEntry, localFilter);
if (validateError) {