MCPcopy
hub / github.com/ocsjs/ocsjs / uuid

Function uuid

packages/core/src/utils/common.ts:8–14  ·  view source on GitHub ↗

创建唯一id , 不带横杠

()

Source from the content-addressed store, hash-verified

6export const $ = {
7 /** 创建唯一id , 不带横杠 */
8 uuid() {
9 return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
10 const r = (Math.random() * 16) | 0;
11 const v = c === 'x' ? r : (r & 0x3) | 0x8;
12 return v.toString(16);
13 });
14 },
15
16 /**
17 * 生成随机数, 使用 Math.round 取整

Callers

nothing calls this directly

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected