(str: string)
| 8 | }; |
| 9 | |
| 10 | export const isBase64String = (str: string) => { |
| 11 | // Refer: https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript |
| 12 | // Use regex to check if the string is base64 encoded rather than decoding it |
| 13 | const base64Regex = /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/; |
| 14 | return base64Regex.test(str); |
| 15 | }; |
no test coverage detected