export const isPopulatedObject = < U extends string = string > ( arg , requiredAttributes = [ ] ) : arg is Record < U , unknown > => { return ( typeof arg === 'object' && arg !== null && Object . keys ( arg ) . length > 0 && ( requiredAttributes . length === 0 || requiredAttributes . every ( ( d ) => ( { } . hasOwnProperty . call ( arg , d ) ) ) ) ) ; } ; /**
 * Get the first key in the object
 * getFirstKeyInObject({ firstKey: {}, secondKey: {}}) -> firstKey
 */ export const getFirstKeyInObject = ( arg ) : string | undefined => { if ( isPopulatedObject ( arg ) ) { const keys = Object . keys ( arg ) ; return keys . length > 0 ? keys [ 0 ] : undefined ; } } ;