Hyperlinkv0.8.0-beta.28

Schema

Schema.isCapitalizedfunctioneffect/Schema.ts:7014
(annotations?: Annotations.Filter): SchemaAST.Filter<string>

Validates that the first character of a string is unchanged by toUpperCase().

Details

Empty strings pass. Strings whose first character has no lowercase form, such as a digit, punctuation mark, or whitespace, also pass.

String checks
Source effect/Schema.ts:701418 lines
export function isCapitalized(annotations?: Annotations.Filter) {
  return makeFilter(
    (s: string) => s.charAt(0).toUpperCase() === s.charAt(0),
    {
      expected: "a string with the first character in uppercase",
      meta: {
        _tag: "isCapitalized",
        regExp: new globalThis.RegExp(CAPITALIZED_PATTERN)
      },
      arbitrary: {
        constraint: {
          patterns: [CAPITALIZED_PATTERN]
        }
      },
      ...annotations
    }
  )
}
Referenced by 1 symbols