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:RootUuid|undefined):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 | RootUuid | undefined | The UUID data to convert. |
Returns
T
The converted GUID value.
toGuidNullable()
statictoGuidNullable<T>(data:RootUuid|null|undefined):T|undefined
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 | RootUuid | null | undefined | The nullable UUID data to convert. |
Returns
T | undefined
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:RootUuid|undefined):string
Converts a RootUuid to a base64 encoded string.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | RootUuid | undefined | The UUID data to convert. |
Returns
string
The base64 string representation of the UUID.
toStringFromArray()
statictoStringFromArray(data:Uint8Array):string
Parameters
| Parameter | Type |
|---|---|
data | Uint8Array |
Returns
string
toStringNullable()
statictoStringNullable(data:RootUuid|null|undefined):string|undefined
Converts a nullable RootUuid to a string, returning undefined if the input is null or undefined.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | RootUuid | null | undefined | The nullable UUID data to convert. |
Returns
string | undefined
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:RootGuid|null|undefined):RootUuid|undefined
Converts a nullable RootGuid string to a RootUuid object, returning undefined if the input is null or undefined.
Parameters
| Parameter | Type | Description |
|---|---|---|
strData | RootGuid | null | undefined | The nullable GUID string to convert. |
Returns
RootUuid | undefined
The RootUuid object or undefined.
toUuidString()
statictoUuidString<T>(guid:T|null|undefined):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 | T | null | undefined | The nullable GUID string to convert. |
Returns
string
string