This repository has been archived by the owner on Oct 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
sp core library.guid
John Nguyen edited this page Apr 22, 2021
·
2 revisions
Home > @microsoft/sp-core-library > Guid
This class represents a globally unique identifier, as described by IETF RFC 4122.
Signature:
export default class Guid
The input string is normalized and validated, which provides important guarantees that simplify other code that works with the GUID. This class also provides basic support for generating a pseudo-random GUID; however, be aware that the uniqueness depends on the browser's Math.random()
function and may be not be suitable for some applications.
See RFC4122 for more information.
Property | Modifiers | Type | Description |
---|---|---|---|
empty | static |
Guid | Returns a new empty Guid instance. |
Method | Modifiers | Description |
---|---|---|
equals(guid) | Compare this instance to another Guid instance | |
isValid(guid) | static |
Indicates whether a GUID is valid, i.e. whether it would be successfully parsed by Guid.tryParse() . This function is cheaper than Guid.tryParse() because it does not construct a Guid object. |
newGuid(randomNumberGenerator) | static |
Returns a new Guid instance with a pseudo-randomly generated GUID, according to the version 4 UUID algorithm from RFC 4122. |
parse(guidString) | static |
Parses the input string to construct a new Guid object. If the string cannot be parsed, then an error is thrown. |
toString() | Returns a string representation of the GUID | |
tryParse(guid) | static |
Attempts to parse the input string to construct a new Guid object. If the string cannot be parsed, then undefined is returned. |