@99devco/analytics - v3.0.0
    Preparing search index...

    Function uuid

    • Generates a RFC4122-compliant v4 UUID using crypto functions when available.

      This function creates a cryptographically secure UUID that follows the v4 format: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx where x is any hexadecimal digit and y is one of 8, 9, A, or B.

      The function will use the Web Crypto API (crypto.getRandomValues) when available for better randomness, falling back to a pseudo-random implementation for older browsers.

      Returns string

      A string representing a v4 UUID

      const id = uuid(); // Returns something like "f47ac10b-58cc-4372-a567-0e02b2c3d479"