check browser for webp support
/**
* Webp support
* @return {boolean} - true if supports
*/
export const canUseWebP = () => {
const elem = document.createElement('canvas');
if (!!(elem.getContext && elem.getContext('2d'))) {
return elem.toDataURL('image/webp').indexOf('data:image/webp') === 0;
}
return false;
};