import { FeaturedImageModel } from 'api-client' ; const ten = 10 ; const roundToOneDecimal = ( number ) => Math . round ( number * ten ) / ten ; param featuredImage param defaultWidth returns { string } const featuredImageToSrcSet = ( featuredImage , defaultWidth ) : string => [ featuredImage . thumbnail , featuredImage . medium , featuredImage . large , featuredImage . full ] . map ( ( { url , width } ) => `${ encodeURI ( url ) } ${ roundToOneDecimal ( width / defaultWidth ) }x` ) . join ( ', ' ) ; export default featuredImageToSrcSet ;