MCPcopy Create free account
hub / github.com/esengine/esengine / formatUUID

Function formatUUID

packages/core/src/Utils/GUID.ts:67–70  ·  view source on GitHub ↗

* 格式化 16 字节数组为 UUID 字符串 * * Format 16-byte array to UUID string.

(bytes: Uint8Array)

Source from the content-addressed store, hash-verified

65 * Format 16-byte array to UUID string.
66 */
67function formatUUID(bytes: Uint8Array): string {
68 const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join('');
69 return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
70}
71
72/**
73 * 验证字符串是否为有效的 UUID 格式

Callers 1

generateGUIDFallbackFunction · 0.85

Calls 3

joinMethod · 0.45
fromMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected