UNPKG

apphouse

Version:

Component library for React that uses observable state management and theme-able components.

20 lines (16 loc) 522 B
export function replaceUndefinedValuesWithNull( obj: Record<string, any> ): Record<string, any> { const result: Record<string, any> = {}; for (const [key, value] of Object.entries(obj)) { if (typeof value === 'object' && value !== null) { result[key] = replaceUndefinedValuesWithNull(value); } else { result[key] = value === undefined ? 'undefined' : value; if (value === undefined) { console.log('FOUND UNDEFINED', key, value, result[key]); } } } return result; }