MCPcopy Create free account
hub / github.com/Effect-TS/effect / isBase64

Function isBase64

packages/effect/src/Schema.ts:7125–7140  ·  view source on GitHub ↗
(annotations?: Annotations.Filter)

Source from the content-addressed store, hash-verified

7123 * @since 4.0.0
7124 */
7125export function isBase64(annotations?: Annotations.Filter) {
7126 const regExp = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/
7127 return isPattern(
7128 regExp,
7129 {
7130 expected: "a base64 encoded string",
7131 representation: {
7132 id: "effect/schema/isBase64",
7133 payload: null
7134 },
7135 toJsonSchema: () => ({ pattern: regExp.source }),
7136 toCode: () => ({ runtime: "Schema.isBase64()" }),
7137 ...annotations
7138 }
7139 )
7140}
7141
7142/**
7143 * Reviver for persisted `isBase64` checks.

Callers 1

Schema.tsFile · 0.85

Calls 1

isPatternFunction · 0.70

Tested by

no test coverage detected