* 格式化 16 字节数组为 UUID 字符串 * * Format 16-byte array to UUID string.
(bytes: Uint8Array)
| 65 | * Format 16-byte array to UUID string. |
| 66 | */ |
| 67 | function 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 格式 |
no test coverage detected