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

Function isTrimmed

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

Source from the content-addressed store, hash-verified

6686 * @since 4.0.0
6687 */
6688export function isTrimmed(annotations?: Annotations.Filter) {
6689 const regExp = new globalThis.RegExp(TRIMMED_PATTERN)
6690 return makeFilter(
6691 (s: string) => s.trim() === s,
6692 {
6693 expected: "a string with no leading or trailing whitespace",
6694 representation: {
6695 id: "effect/schema/isTrimmed",
6696 payload: null
6697 },
6698 toJsonSchema: () => ({ pattern: regExp.source }),
6699 toCode: () => ({ runtime: "Schema.isTrimmed()" }),
6700 arbitrary: {
6701 constraint: {
6702 patterns: [TRIMMED_PATTERN]
6703 }
6704 },
6705 ...annotations
6706 }
6707 )
6708}
6709
6710/**
6711 * Reviver for persisted `isTrimmed` checks.

Callers 1

Schema.tsFile · 0.85

Calls 1

makeFilterFunction · 0.85

Tested by

no test coverage detected