Class: UUID

UUID

UUID object.
Source:

Members

(static, constant) FIELD_NAMES :Array.<string>

Names of UUID internal fields.
Type:
  • Array.<string>
Since:
  • 3.0
Source:

(static, constant) FIELD_SIZES :Array.<number>

Sizes of UUID internal fields.
Type:
  • Array.<number>
Since:
  • 3.0
Source:

(static, constant) NIL :UUID

Nil UUID object.
Type:
Since:
  • v3.4.0
Source:

(static) overwrittenUUID :any

Retains the value of 'UUID' global variable assigned before loading UUID.js.
Type:
  • any
Since:
  • 3.2
Source:

bitFields :Array.<string>

UUID internal field values as an array of binary strings.
Type:
  • Array.<string>
Source:

bitString :string

128-bit binary string representation.
Type:
  • string
Source:

hexFields :Array.<string>

UUID internal field values as an array of hexadecimal strings.
Type:
  • Array.<string>
Source:

hexNoDelim :string

Non-delimited hexadecimal string representation ("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx").
Type:
  • string
Since:
  • v3.3.0
Source:

hexString :string

Hexadecimal string representation ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx").
Type:
  • string
Source:

intFields :Array.<number>

UUID internal field values as an array of integers.
Type:
  • Array.<number>
Source:

urn :string

URN string representation ("urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx").
Type:
  • string
Source:

version :number

UUID version number.
Type:
  • number
Source:

Methods

(static) generate() → {string}

Generates a version 4 UUID as a hexadecimal string.
Source:
Returns:
Hexadecimal UUID string.
Type
string

(static) genV1() → {UUID}

Creates a version 1 UUID object.
Since:
  • 3.0
Source:
Returns:
Version 1 UUID object.
Type
UUID

(static) genV4() → {UUID}

Creates a version 4 UUID object.
Since:
  • 3.0
Source:
Returns:
Version 4 UUID object.
Type
UUID

(static) makeBackwardCompatible()

Reinstalls UUID.generate method to emulate the interface of UUID.js version 2.x.
Since:
  • 3.1
Deprecated:
  • Version 2.x compatible interface is not recommended.
Source:

(static) parse(strId) → {UUID}

Converts a hexadecimal UUID string to a UUID object.
Parameters:
Name Type Description
strId string Hexadecimal UUID string ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx").
Since:
  • 3.0
Source:
Returns:
UUID object or null.
Type
UUID

(static) resetState()

Re-initializes the internal state for version 1 UUID creation.
Since:
  • 3.0
Source:

(static) useMathRandom()

Enables Math.random()-based pseudorandom number generator instead of cryptographically safer options.
Since:
  • v3.5.0
Deprecated:
  • This method is provided only to work around performance drawbacks of the safer algorithms.
Source:

equals(uuid) → {boolean}

Tests if two UUID objects are equal.
Parameters:
Name Type Description
uuid UUID
Source:
Returns:
True if two UUID objects are equal.
Type
boolean

toString() → {string}

Returns the hexadecimal string representation.
Source:
Returns:
Type
string