Last active
April 10, 2022 09:56
-
-
Save amarbalu/822c4a3c3124a793e5b2f031fc26b398 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const canUseWebp = headers => { | |
//headers will be passed as an input | |
const { accept: header = '' } = headers || {}; | |
// accept is denoted as header | |
let useWebp = false; | |
if (header && header.indexOf('image/webp') !== -1) { | |
// Server side rendering | |
useWebp = true; | |
} | |
return useWebp; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment