UNPKG

@hangtime/grip-connect

Version:

Griptonite Motherboard, Tindeq Progressor, PitchSix Force Board, WHC-06, Entralpi, Climbro, mySmartBoard: Bluetooth API Force-Sensing strength analysis for climbers

24 lines 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BaseModel = void 0; class BaseModel { constructor(base) { var _a, _b, _c, _d, _e, _f; this.id = (_d = (_a = base.id) !== null && _a !== void 0 ? _a : (_c = (_b = globalThis.crypto) === null || _b === void 0 ? void 0 : _b.randomUUID) === null || _c === void 0 ? void 0 : _c.call(_b)) !== null && _d !== void 0 ? _d : BaseModel.generateUUID(); this.createdAt = (_e = base.createdAt) !== null && _e !== void 0 ? _e : new Date(); this.updatedAt = (_f = base.updatedAt) !== null && _f !== void 0 ? _f : new Date(); } /** * Generates a UUID using a simple algorithm. * @returns A string representing a UUID. */ static generateUUID() { return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => { const r = Math.floor(Math.random() * 16); const v = c === "x" ? r : (r & 0x3) | 0x8; return v.toString(16); }); } } exports.BaseModel = BaseModel; //# sourceMappingURL=base.model.js.map