import format from 'string-format' ; export interface Map { [ key ] : any ; [ index ] : any ; } export function iterateFormat ( item , formatObject ) { if ( typeof item === 'object' ) { for ( const key in item ) { const parsedKey = format ( key , formatObject ) ; item [ parsedKey ] = iterateFormat ( item [ key ] , formatObject ) ; parsedKey !== key && delete item [ key ] ; } } else if ( typeof item === 'string' ) { return format ( item , formatObject ) ; } return item ; } export const randomFromArray = < T > ( x ) => x [ Math . floor ( Math . random ( ) * x . length ) ] ;