@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
133 lines • 3.15 kB
TypeScript
/**
* Universally Unique Identifier (UUID), a 128 bit label used to uniquely identify resources.
* The default is Nil UUID, where all bits are set to 0, see {@link UUID.nil}.
* Also known as GUID ( Globally Unique IDentifier).
*
* @see IETF RFC 4122 - https://datatracker.ietf.org/doc/html/rfc4122
* @example
* class Student{
* id: UUID
* name: string
* age: number
* }
* @example
* const id_a = UUID.v1();
* const id_b = UUID.v1();
*
* id_a.equals(id_b); // false
*
* @author Alex Goldring
* @copyright Company Named Limited (c) 2025
*/
export class UUID {
/**
*
* @return {UUID}
*/
static v1(): UUID;
/**
* Variant 4 UUID generator (fully random)
* @returns {UUID}
*/
static v4(): UUID;
/**
* Shortcut to generate string-form ID
* Uses v4(random) UUID
* @return {string}
*/
static string(): string;
/**
*
* @param {string} string
* @return {UUID}
*/
static parse(string: string): UUID;
/**
*
* @param {number[]|Uint8Array|ArrayLike<number>} bytes
*/
set data(arg: Uint8Array);
/**
*
* @returns {Uint8Array}
*/
get data(): Uint8Array;
/**
* The version number is in the most significant 4 bits of the timestamp (bits 4 through 7 of the time_hi_and_version field).
*
* @see https://datatracker.ietf.org/doc/html/rfc4122#section-4.1.3
* @return {number}
* @example
* UUID.v1().version === 1
* UUID.v4().version === 4
*/
get version(): number;
/**
* The nil UUID is special form of UUID that is specified to have all 128 bits set to zero.
* Clears all bits of this UUID.
* @returns {void}
*/
nil(): void;
/**
* Generate Variant 1 UUID
* @returns {void}
*/
v1(): void;
/**
* Generate Variant 4 UUID (fully random)
* @returns {void}
*/
v4(): void;
/***
* Parses standard UUID string of form AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE
* @param {string} string String in UUID format
*/
parse(string: string): void;
/**
* Standard UUID string in from: AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE
* Result is compatible with the {@link UUID.parse} method.
* @example
* a88bb73a-c89f-11ed-afa1-0242ac120002
* @returns {string}
*/
toString(): string;
/**
* Sets this UUID to hold the same value as the other
* @param {UUID} other
*/
copy(other: UUID): void;
/**
*
* @return {UUID}
*/
clone(): UUID;
/**
*
* @param {UUID} other
* @returns {boolean}
*/
equals(other: UUID): boolean;
/**
* Compute hash sum
* @returns {number} 32bit integer value
*/
hash(): number;
/**
* @readonly
*/
readonly toJSON: () => string;
/**
* @readonly
*/
readonly fromJSON: (string: string) => void;
/**
* @readonly
* @type {boolean}
*/
readonly isUUID: boolean;
#private;
}
export namespace UUID {
let typeName: string;
}
//# sourceMappingURL=UUID.d.ts.map