export function nameOf < T > ( name ) { return name ; } export function getNameOf < T > ( ) { return ( name ) => name ; } export function getErrorMessage ( ex ) { if ( ex instanceof Error ) { return ex . message ; } return JSON . stringify ( ex ) ; } export function arrayToRecord < T > ( source , getKey ) { return source . reduce ( ( all , a ) => ( { ... all , [ getKey ( a ) ] : a } ) , { } ) as Record < string , T > ; }