UNPKG

ts-scikit

Version:

A scientific toolkit written in Typescript

36 lines 923 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Guid = void 0; /** * A GUID. */ class Guid { constructor(value) { this._value = value; } /** * Creates a new Guid. */ static Create() { const value = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => { const r = Math.random() * 16 | 0; const v = (c === 'x') ? r : (r & 0x3 | 0x8); return v.toString(16); }); return new Guid(value); } /** * Gets the value of this guid. */ get value() { return this._value; } /** * Determines is this guid equals a provided guid. * @param guid the guid. * @returns true, if this guid equals the other guid; false, otherwise. */ equals(guid) { return this._value === guid.value; } } exports.Guid = Guid; //# sourceMappingURL=guid.js.map