(uuid: string)
| 59 | } |
| 60 | |
| 61 | export function uuidToBytes(uuid: string): Uint8Array<ArrayBuffer> { |
| 62 | if (uuid.length !== 36) { |
| 63 | log.warn( |
| 64 | 'received a string of invalid length. Returning an empty Uint8Array' |
| 65 | ); |
| 66 | return new Uint8Array(0); |
| 67 | } |
| 68 | |
| 69 | return Uint8Array.from( |
| 70 | chunk(uuid.replace(/-/g, ''), 2).map(pair => parseInt(pair.join(''), 16)) |
| 71 | ); |
| 72 | } |
no test coverage detected