Function validate

  • Determines whether a string is a valid UUID.

    Parameters

    • uuid: string

      UUID value.

    Returns boolean

    true if the string is a valid UUID, otherwise false.

    import { validate } from "@std/uuid";
    import { assert, assertFalse } from "@std/assert";

    assert(validate("6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b"));
    assertFalse(validate("not a UUID"));