| 7443 | * @since 4.0.0 |
| 7444 | */ |
| 7445 | export function isLowercased(annotations?: Annotations.Filter) { |
| 7446 | const regExp = new globalThis.RegExp(LOWERCASED_PATTERN) |
| 7447 | return makeFilter( |
| 7448 | (s: string) => s.toLowerCase() === s, |
| 7449 | { |
| 7450 | expected: "a string with all characters in lowercase", |
| 7451 | representation: { |
| 7452 | id: "effect/schema/isLowercased", |
| 7453 | payload: null |
| 7454 | }, |
| 7455 | toJsonSchema: () => ({ pattern: regExp.source }), |
| 7456 | toCode: () => ({ runtime: "Schema.isLowercased()" }), |
| 7457 | arbitrary: { |
| 7458 | constraint: { |
| 7459 | patterns: [LOWERCASED_PATTERN] |
| 7460 | } |
| 7461 | }, |
| 7462 | ...annotations |
| 7463 | } |
| 7464 | ) |
| 7465 | } |
| 7466 | |
| 7467 | /** |
| 7468 | * Reviver for persisted `isLowercased` checks. |