Hyperlinkv0.8.0-beta.28

Schema

Schema.isBase64Urlfunctioneffect/Schema.ts:6817
(annotations?: Annotations.Filter): SchemaAST.Filter<string>

Validates that a string is valid Base64URL encoded data (Base64 with URL-safe characters).

Details

JSON Schema:

This check corresponds to a pattern constraint in JSON Schema that matches Base64URL format.

Arbitrary:

When generating test data with fast-check, this applies a patterns constraint to ensure generated strings match the Base64URL pattern.

String checks
Source effect/Schema.ts:681714 lines
export function isBase64Url(annotations?: Annotations.Filter) {
  const regExp = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/
  return isPattern(
    regExp,
    {
      expected: "a base64url encoded string",
      meta: {
        _tag: "isBase64Url",
        regExp
      },
      ...annotations
    }
  )
}
Referenced by 1 symbols