| 7123 | * @since 4.0.0 |
| 7124 | */ |
| 7125 | export 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. |