(options: Option = {}, filters?: Filter[])
| 247 | } |
| 248 | |
| 249 | const queryData = (options: Option = {}, filters?: Filter[]): ClientResponse => { |
| 250 | |
| 251 | const convert = (a: [string, number]) => ({ |
| 252 | name: a[0], |
| 253 | count: a[1] |
| 254 | }) |
| 255 | |
| 256 | const versionToString = (version: Version): string => { |
| 257 | let versionString = '' + version.major |
| 258 | |
| 259 | if (version.minor !== undefined) { |
| 260 | versionString += '.' + version.minor |
| 261 | } |
| 262 | |
| 263 | if (version.patch !== undefined) { |
| 264 | versionString += '.' + version.patch |
| 265 | } |
| 266 | |
| 267 | if (version.tag !== undefined) { |
| 268 | versionString += '-' + version.tag |
| 269 | } |
| 270 | |
| 271 | return versionString |
| 272 | } |
| 273 | |
| 274 | const runtimeToString = (runtime: Runtime): string => { |
| 275 | let runtimeString = '' |
| 276 | |
| 277 | if (runtime.name) { |
| 278 | runtimeString += runtime.name |
| 279 | } |
| 280 | |
| 281 | if (options.showRuntimeVersion && runtime.version) { |
| 282 | runtimeString += versionToString(runtime.version) |
| 283 | } |
| 284 | |
| 285 | return runtimeString |
| 286 | } |
| 287 | |
| 288 | const operatingSystemToString = (os: OperatingSytem): string => { |
| 289 | let osString = [] |
| 290 | |
| 291 | if (os.vendor) { |
| 292 | osString.push(os.vendor) |
| 293 | } |
| 294 | |
| 295 | if (options.showOperatingSystemArchitecture && os.architecture) { |
| 296 | osString.push(os.architecture) |
| 297 | } |
| 298 | |
| 299 | return osString.join('-') |
| 300 | } |
| 301 | |
| 302 | const cache = { |
| 303 | clients: SortedMap<string, number>((a, b) => b[1] - a[1]), |
| 304 | versions: SortedMap<string, number>((a, b) => b[1] - a[1]), |
| 305 | runtimes: SortedMap<string, number>((a, b) => b[1] - a[1]), |
| 306 | operatingSystems: SortedMap<string, number>((a, b) => b[1] - a[1]) |
nothing calls this directly
no test coverage detected