8 if (/Android/i.test(ua)) {
9 // android must be tested before linux
11 } else if (/iOS|iPhone|Macintosh|Darwin|OS\s*X|macOS|mac/i.test(ua)) {
13 } else if (/Linux/i.test(ua) && !/cygwin|msysgit/i.test(ua)) {
14 // It's the year of the Linux Desktop!
15 // See also http://www.mslinux.org/
16 // 'linux' must be tested before 'Microsoft' because WSL
17 // (TODO: does this affect cygwin / msysgit?)
19 } else if (/^ms$|Microsoft|Windows|win32|win|PowerShell/i.test(ua)) {
20 // 'win' must be tested after 'darwin'
22 } else if (/Linux|curl|wget/i.test(ua)) {
23 // test 'linux' again, after 'win'
30 function getArch(ua) {
35 if (/arm64|arm8|armv8/i.test(ua)) {
37 } else if (/arm7|armv7/i.test(ua)) {
39 } else if (/arm6|armv6/i.test(ua)) {
41 } else if (/ppc64/i.test(ua)) {
43 } else if (/mips64/i.test(ua)) {
45 } else if (/mips/i.test(ua)) {
47 } else if (/(amd64|x64|_64)\b/i.test(ua)) {
48 // must come after ppc64/mips64
50 } else if (/(3|6|x|_)86\b/i.test(ua)) {
51 // must come after x86_64
54 // TODO handle explicit invalid different
59 module.exports.os = getOs;
60 module.exports.arch = getArch;