// Utility to safely get a field value from a form data object
export function safeGetField(field, formData) {
  if (formData && Object.prototype.hasOwnProperty.call(formData, field)) {
    const value = formData[field];
    // If the value is undefined or null, return empty string for backward compatibility
    if (value === undefined || value === null) {
      return '';
    }
    return value;
  }
  if (process.env.NODE_ENV !== 'production') {
    // Only warn in development
    console.warn(`Field '${field}' is missing or inaccessible.`);
  }
  return '';
} 