From 83b7717ab9965a8b82b866721f5375cdfc136618 Mon Sep 17 00:00:00 2001 From: xiaosong Date: Tue, 18 Sep 2018 16:24:02 +0800 Subject: [PATCH] fix: edge Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134 --- lib/ua-device.js | 6 +++--- test/test_input | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/ua-device.js b/lib/ua-device.js index f72fe0c..546131c 100755 --- a/lib/ua-device.js +++ b/lib/ua-device.js @@ -678,11 +678,11 @@ module.exports = function (ua) { }; } // Microsoft Edge - else if (/Edge\/12/i.test(ua) && /Windows Phone|Windows NT/i.test(ua)) { + else if (match = /Edge\/(\d+([\d\.]+)?)/i.exec(ua) && /Windows Phone|Windows NT/i.test(ua)) { uaData.browser.name = 'Microsoft Edge'; uaData.browser.version = { - major: '12', - original: '12' + // major: match[1], + original: match[1], }; } // miui browser diff --git a/test/test_input b/test/test_input index e99e694..73062bd 100644 --- a/test/test_input +++ b/test/test_input @@ -3289,4 +3289,5 @@ vivo_Y11iW/1.0 Linux/3.4.5 Android/4.2.2 Release/02.11.2015 Browser/AppleWebKit5 vivo_Y11iW/V1.0 Linux/3.4.5 Android/4.2.2 Release/02.11.2015 AppleWebKit/537.36 Profile/MIDP-2.0 Configuration/CLDC-1.1 Mobile Safari/537.36 System/Android 4.2.2 vivo_Y613F/V1.0 Linux/3.10.28-svn1131 Android/4.4.4 Release/10.08.2014 AppleWebKit/537.36 Profile/MIDP-2.0 Configuration/CLDC-1.1 Mobile Safari/537.36 System/Android 4.4.4 vivo_Y622/V1.0 Linux/3.4.5 Android/4.2.2 Release/03.12.2015 AppleWebKit/537.36 Profile/MIDP-2.0 Configuration/CLDC-1.1 Mobile Safari/537.36 System/Android 4.2.2 -vivo_Y628/V1.0 Linux/3.10.28-svn930 Android/4.4.4 Release/09.22.2014 AppleWebKit/537.36 Profile/MIDP-2.0 Configuration/CLDC-1.1 Mobile Safari/537.36 System/Android 4.4.4 \ No newline at end of file +vivo_Y628/V1.0 Linux/3.10.28-svn930 Android/4.4.4 Release/09.22.2014 AppleWebKit/537.36 Profile/MIDP-2.0 Configuration/CLDC-1.1 Mobile Safari/537.36 System/Android 4.4.4 +Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134