SourceTermAnalysisSystem_vue/node_modules/@antv/x6-common/lib/string/uuid.js
2026-05-15 10:22:44 +08:00

23 lines
820 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.uuid = void 0;
/* eslint-disable no-bitwise */
function uuid() {
// credit: http://stackoverflow.com/posts/2117523/revisions
// return '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)
// })
let res = '';
const template = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
for (let i = 0, len = template.length; i < len; i += 1) {
const s = template[i];
const r = (Math.random() * 16) | 0;
const v = s === 'x' ? r : s === 'y' ? (r & 0x3) | 0x8 : s;
res += v.toString(16);
}
return res;
}
exports.uuid = uuid;
//# sourceMappingURL=uuid.js.map