Hyperlinkv0.8.0-beta.28

Schema

Schema.isLowercasedfunctioneffect/Schema.ts:6981
(annotations?: Annotations.Filter): SchemaAST.Filter<string>

Validates that a string is unchanged by JavaScript's toLowerCase().

Details

This accepts empty strings and characters that do not have uppercase forms, such as digits, punctuation, and whitespace. It rejects strings that would change when lowercased.

String checks
Source effect/Schema.ts:698118 lines
export function isLowercased(annotations?: Annotations.Filter) {
  return makeFilter(
    (s: string) => s.toLowerCase() === s,
    {
      expected: "a string with all characters in lowercase",
      meta: {
        _tag: "isLowercased",
        regExp: new globalThis.RegExp(LOWERCASED_PATTERN)
      },
      arbitrary: {
        constraint: {
          patterns: [LOWERCASED_PATTERN]
        }
      },
      ...annotations
    }
  )
}
Referenced by 1 symbols