(annotations?: Annotations.Filter): SchemaAST.Filter<string>Validates that a string is valid Base64 encoded data.
Details
JSON Schema:
This check corresponds to a pattern constraint in JSON Schema that matches
Base64 format.
Arbitrary:
When generating test data with fast-check, this applies a patterns
constraint to ensure generated strings match the Base64 pattern.
export function function isBase64(
annotations?: Annotations.Filter
): SchemaAST.Filter<string>
Validates that a string is valid Base64 encoded data.
Details
JSON Schema:
This check corresponds to a pattern constraint in JSON Schema that matches
Base64 format.
Arbitrary:
When generating test data with fast-check, this applies a patterns
constraint to ensure generated strings match the Base64 pattern.
isBase64(annotations: Annotations.Filter | undefinedannotations?: Annotations.interface Annotations.FilterAnnotations for filter schema nodes (created via Schema.filter). Extends
Augment
with an optional error message, identifier, and metadata.
Filters are intentionally non-parametric to keep them covariant.
Filter) {
const const regExp: globalThis.RegExpregExp = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/
return const isPattern: (
regExp: globalThis.RegExp,
annotations?: Annotations.Filter
) => SchemaAST.Filter<string>
Validates that a string matches the specified regular expression pattern.
Details
JSON Schema:
This check corresponds to the pattern constraint in JSON Schema.
Arbitrary:
When generating test data with fast-check, this applies a patterns
constraint to ensure generated strings match the specified RegExp pattern.
isPattern(
const regExp: globalThis.RegExpregExp,
{
Annotations.Augment.expected?: string | undefinedHuman-readable description of what a value is expected to satisfy.
Details
For filter and refinement failures, the default formatter uses
message first, then expected, and finally falls back to <filter>.
Use this to name a failed filter in the default message:
Expected <expected>, got <actual>.
expected: "a base64 encoded string",
Annotations.Filter.meta?: Annotations.Meta | undefined(property) Annotations.Filter.meta?: {
_tag: 'isBase64';
regExp: globalThis.RegExp;
}
Optional metadata used to identify or extend the filter with custom data.
meta: {
_tag: "isBase64"_tag: "isBase64",
regExp: globalThis.RegExpregExp
},
...annotations: Annotations.Filter | undefinedannotations
}
)
}