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

Function isUUID

packages/effect/src/Schema.ts:6957–6972  ·  view source on GitHub ↗
(version?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8, annotations?: Annotations.Filter)

Source from the content-addressed store, hash-verified

6955 * @since 4.0.0
6956 */
6957export function isUUID(version?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8, annotations?: Annotations.Filter) {
6958 const regExp = getUUIDRegExp(version)
6959 return isPattern(
6960 regExp,
6961 {
6962 expected: version ? `a UUID v${version}` : "a UUID",
6963 representation: {
6964 id: "effect/schema/isUUID",
6965 payload: { version: version ?? null }
6966 },
6967 toJsonSchema: () => ({ pattern: regExp.source, format: "uuid" }),
6968 toCode: () => ({ runtime: version === undefined ? "Schema.isUUID()" : `Schema.isUUID(${version})` }),
6969 ...annotations
6970 }
6971 )
6972}
6973
6974/**
6975 * Reviver for persisted `isUUID` checks.

Callers 1

Schema.tsFile · 0.85

Calls 2

getUUIDRegExpFunction · 0.85
isPatternFunction · 0.70

Tested by

no test coverage detected