RootGuidUtils
Utility class for working with Root GUIDs, providing methods to convert between different formats (UUID, GUID, and string) and to extract metadata like timestamps.
Methods
stringToUint8Array()
staticstringToUint8Array(uuid:string):Uint8Array
Parameters
| Parameter | Type |
|---|---|
uuid | string |
Returns
Uint8Array
toGuid()
statictoGuid<T>(data:undefined|RootUuid):T
Converts a RootUuid to a generic type T, typically used for converting to RootGuid.
Type Parameters
| Type Parameter |
|---|
T extends string |
Parameters
| Parameter | Type | Description |
|---|---|---|
data | undefined | RootUuid | The UUID data to convert. |
Returns
T
The converted GUID value.
toGuidNullable()
statictoGuidNullable<T>(data:undefined|null|RootUuid):undefined|T
Converts a nullable RootUuid to a generic type T, returning undefined if the input is null or undefined.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
data | undefined | null | RootUuid | The nullable UUID data to convert. |
Returns
undefined | T
The converted GUID value or undefined.
toMilliseconds()
statictoMilliseconds(strData:string):number
Converts a GUID string to a timestamp in milliseconds since the ROOT_EPOCH.
Parameters
| Parameter | Type | Description |
|---|---|---|
strData | string | The GUID string to extract the timestamp from. |
Returns
number
The timestamp in milliseconds.
Throws
Will throw an error if the input string is null or invalid.
toRootGuidType()
statictoRootGuidType(strData:string):RootGuidType
Extracts the RootGuidType from a string.
Parameters
| Parameter | Type | Description |
|---|---|---|
strData | string | The GUID string to extract the type from. |
Returns
The extracted RootGuidType value.
toString()
statictoString(data:undefined|RootUuid):string
Converts a RootUuid to a base64 encoded string.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | undefined | RootUuid | The UUID data to convert. |
Returns
string
The base64 string representation of the UUID.
toStringNullable()
statictoStringNullable(data:undefined|null|RootUuid):undefined|string
Converts a nullable RootUuid to a string, returning undefined if the input is null or undefined.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | undefined | null | RootUuid | The nullable UUID data to convert. |
Returns
undefined | string
The base64 string representation or undefined.
toUuid()
statictoUuid(strData:RootGuid):RootUuid
Converts a RootGuid string to a RootUuid object.
Parameters
| Parameter | Type | Description |
|---|---|---|
strData | RootGuid | The GUID string to convert. |
Returns
RootUuid
The RootUuid object.
Throws
Will throw an error if the input string is empty or invalid.
toUuidNullable()
statictoUuidNullable(strData:undefined|null|RootGuid):undefined|RootUuid
Converts a nullable RootGuid string to a RootUuid object, returning undefined if the input is null or undefined.
Parameters
| Parameter | Type | Description |
|---|---|---|
strData | undefined | null | RootGuid | The nullable GUID string to convert. |
Returns
undefined | RootUuid
The RootUuid object or undefined.
toUuidString()
statictoUuidString<T>(guid:undefined|null|T):string
Converts a nullable RootGuid to standard UUID formatted string, returning blank if the input is null or undefined;
Type Parameters
| Type Parameter |
|---|
T extends string |
Parameters
| Parameter | Type | Description |
|---|---|---|
guid | undefined | null | T | The nullable GUID string to convert. |
Returns
string
string