validate
validate(
value):value is string
Defined in: src/uuid/codec.ts:127
Whether value is a well-formed UUID string.
Checks the fields RFC 9562 constrains, not just the shape: the version
nibble must be 1 through 8 (§4.1) and the variant must be 10xx (§4.2).
Nil (§5.9) and Max (§5.10) are accepted as the two named exceptions.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”value is string
Example
Section titled “Example”validate(v4()); // truevalidate(NIL); // truevalidate(MAX); // truevalidate("nope"); // falsevalidate(42); // false
// Right shape, but no such version and the wrong variant bits.validate("11111111-1111-9111-1111-111111111111"); // false