MCPcopy Create free account
hub / github.com/Kong/insomnia / isBase64String

Function isBase64String

packages/insomnia/src/ui/utils/string-check.ts:10–15  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

8};
9
10export 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};

Callers 1

parseConfigValueFunction · 0.90

Calls 1

testMethod · 0.45

Tested by

no test coverage detected