Members
(static, constant) FIELD_NAMES :Array.<string>
Names of UUID internal fields.
Type:
- Array.<string>
(static, constant) FIELD_SIZES :Array.<number>
Sizes of UUID internal fields.
Type:
- Array.<number>
(static, constant) NIL :UUID
Nil UUID object.
Type:
(static) overwrittenUUID :any
Retains the value of 'UUID' global variable assigned before loading UUID.js.
Type:
- any
bitFields :Array.<string>
UUID internal field values as an array of binary strings.
Type:
- Array.<string>
bitString :string
128-bit binary string representation.
Type:
- string
hexFields :Array.<string>
UUID internal field values as an array of hexadecimal strings.
Type:
- Array.<string>
hexNoDelim :string
Non-delimited hexadecimal string representation ("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx").
Type:
- string
hexString :string
Hexadecimal string representation ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx").
Type:
- string
intFields :Array.<number>
UUID internal field values as an array of integers.
Type:
- Array.<number>
urn :string
URN string representation ("urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx").
Type:
- string
version :number
UUID version number.
Type:
- number
Methods
(static) generate() → {string}
Generates a version 4 UUID as a hexadecimal string.
Returns:
Hexadecimal UUID string.
- Type
- string
(static) genV1() → {UUID}
Creates a version 1 UUID object.
Returns:
Version 1 UUID object.
- Type
- UUID
(static) genV4() → {UUID}
Creates a version 4 UUID object.
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"). |
Returns:
UUID object or null.
- Type
- UUID
(static) resetState()
Re-initializes the internal state for version 1 UUID creation.
(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 |
Returns:
True if two UUID objects are equal.
- Type
- boolean
toString() → {string}
Returns the hexadecimal string representation.
Returns:
- Type
- string