const randomKey = Math . random ( ) . toString ( ) ; export const FRIENDLY_MESSAGES = { '' : '' , 'auth/user-not-found' : 'No account found, typo maybe?' , 'auth/wrong-password' : 'Password does not match the user account' , 'auth/argument-error' : 'Please provide a valid email' , 'reset email sent' : 'Reset email sent, check your inbox/spam' , 'auth/invalid-email' : `That email address doesn't quite look right` , 'profile saved' : 'Profile Saved' , 'sign-up username taken' : 'Woops sorry, that Username is already taken' , [ randomKey ] : randomKey } ; param systemMessage export const getFriendlyMessage = ( systemMessage = '' ) => { const messageKey = systemMessage . toLowerCase ( ) ; if ( FRIENDLY_MESSAGES . hasOwnProperty ( messageKey ) ) { return FRIENDLY_MESSAGES [ messageKey ] ; } else { console . log ( `%c No friendly message for [${ messageKey }]` , 'background: #222; color: #bada55' ) ; return systemMessage ; } } ;