| 117 | } |
| 118 | |
| 119 | function parseOs(os: string, parseOpt: ParseParam): OperatingSytem | undefined { |
| 120 | const match = matchAll(os, /(linux|windows|darwin|x86_64|x64|amd64)/g) |
| 121 | const matches = Array.from(match); |
| 122 | |
| 123 | if (matches.length) { |
| 124 | const result: any = {}; |
| 125 | matches.forEach((match) => { |
| 126 | const value = match[1]; |
| 127 | const key = osMapping[value]; |
| 128 | result[key] = value; |
| 129 | }); |
| 130 | |
| 131 | return result; |
| 132 | } |
| 133 | |
| 134 | parseOpt.errorCallback('os', os, parseOpt.primaryKey); |
| 135 | return undefined; |
| 136 | } |
| 137 | |
| 138 | function parseRuntime(runtime: string, parseOpt: ParseParam): Runtime | undefined { |
| 139 | const matches = runtime.match(/(?<name>[a-zA-Z]+)?-?(?<version>[\d+.?]+)/); |