MCPcopy Create free account
hub / github.com/Effect-TS/effect / isCapitalized

Function isCapitalized

packages/effect/src/Schema.ts:7499–7519  ·  view source on GitHub ↗
(annotations?: Annotations.Filter)

Source from the content-addressed store, hash-verified

7497 * @since 4.0.0
7498 */
7499export function isCapitalized(annotations?: Annotations.Filter) {
7500 const regExp = new globalThis.RegExp(CAPITALIZED_PATTERN)
7501 return makeFilter(
7502 (s: string) => s.charAt(0).toUpperCase() === s.charAt(0),
7503 {
7504 expected: "a string with the first character in uppercase",
7505 representation: {
7506 id: "effect/schema/isCapitalized",
7507 payload: null
7508 },
7509 toJsonSchema: () => ({ pattern: regExp.source }),
7510 toCode: () => ({ runtime: "Schema.isCapitalized()" }),
7511 arbitrary: {
7512 constraint: {
7513 patterns: [CAPITALIZED_PATTERN]
7514 }
7515 },
7516 ...annotations
7517 }
7518 )
7519}
7520
7521/**
7522 * Reviver for persisted `isCapitalized` checks.

Callers 1

Schema.tsFile · 0.85

Calls 1

makeFilterFunction · 0.85

Tested by

no test coverage detected