is guarnteed to work as expected. Here is the implementation btw:
import mapValues from 'lodash.mapvalues'// Note: not working with arraysexport function coerceEmptyStringsToUndefined(o: unknown): any { if (typeof o === 'object' && o !== null) { if (Array.isArray(o)) { // return something here if you want it to work with arrays } else { return mapValues(o, coerceEmptyStringsToUndefined) } } return o === '' ? undefined : o}
import mapValues from 'lodash.mapvalues'// Note: not working with arraysexport function coerceEmptyStringsToUndefined(o: unknown): any { if (typeof o === 'object' && o !== null) { if (Array.isArray(o)) { // return something here if you want it to work with arrays } else { return mapValues(o, coerceEmptyStringsToUndefined) } } return o === '' ? undefined : o}