(result: string)
| 31 | } |
| 32 | |
| 33 | function expose(result: string): string | undefined { |
| 34 | switch (platform) { |
| 35 | case 'darwin': |
| 36 | return result |
| 37 | .split('IOPlatformUUID')[1] |
| 38 | ?.split('\n')[0] |
| 39 | ?.replace(/=|\s+|"/gi, '') |
| 40 | .toLowerCase(); |
| 41 | case 'win32': |
| 42 | return result |
| 43 | .toString() |
| 44 | .split('REG_SZ')[1] |
| 45 | ?.replace(/\r+|\n+|\s+/gi, '') |
| 46 | .toLowerCase(); |
| 47 | case 'linux': |
| 48 | return result |
| 49 | .toString() |
| 50 | .replace(/\r+|\n+|\s+/gi, '') |
| 51 | .toLowerCase(); |
| 52 | case 'freebsd': |
| 53 | return result |
| 54 | .toString() |
| 55 | .replace(/\r+|\n+|\s+/gi, '') |
| 56 | .toLowerCase(); |
| 57 | default: |
| 58 | throw new Error(`Unsupported platform: ${process.platform}`); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | export function getMachineId() { |
| 63 | if (!(platform in guid)) { |
no test coverage detected