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

Function getUUIDRegExp

packages/effect/src/Schema.ts:6918–6925  ·  view source on GitHub ↗
(version?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8)

Source from the content-addressed store, hash-verified

6916 * Optionally specify a version 1-8. If no version is specified (`undefined`), all versions are supported.
6917 */
6918const getUUIDRegExp = (version?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8): globalThis.RegExp => {
6919 if (version) {
6920 return new globalThis.RegExp(
6921 `^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`
6922 )
6923 }
6924 return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$/
6925}
6926
6927/**
6928 * Validates that a string is a strict Universally Unique Identifier (UUID).

Callers 1

isUUIDFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected