diff --git a/dist/smartbear-browser-info.js b/dist/smartbear-browser-info.js index ae51e09..068221e 100644 --- a/dist/smartbear-browser-info.js +++ b/dist/smartbear-browser-info.js @@ -1,4 +1,4 @@ -/* @smartbear/browser-info v1.0.0 | Copyright 2020 (c) SmartBear Software and contributors | https://github.com/SmartBear/browser-info/blob/master/LICENSE */ +/* @smartbear/browser-info v1.0.1 | Copyright 2020 (c) SmartBear Software and contributors | https://github.com/SmartBear/browser-info/blob/master/LICENSE */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : @@ -38,10 +38,7 @@ const browsers = [new Entity('Firefox', /Firefox\/([0-9.]+)/), new Entity('Opera', /OPR\/([0-9.]+)/), new Entity('Edge', /Edge\/([0-9.]+)/), new Entity('Maxthon', /Maxthon\/([0-9.]+)/), new Entity('Chrome', /Chrome\/([0-9.]+)/), new Entity('Safari', /Version\/([0-9.]+) Safari\//), new Entity('InternetExplorer', /MSIE ([0-9.]+)/)]; - // /\([^)]*?([A-Z][a-z][A-Za-z]+)([A-Za-z0-9_ ]* )([0-9._]+)[;) ]/ 1 - system, 2 - architektura, 3 - wersja - // /\([^)]*?[A-Z][a-z][A-Za-z]+[A-Za-z0-9_ ]* [0-9._]+[;)]|\([^)]*?[A-Z][a-z][A-Za-z0-9 !_]+/ - - const platforms = [new Entity('Windows', /Windows NT ([0-9.]+)/), new Entity('Windows Phone', /Windows Phone ([0-9.]+)/), new Entity('MacOS', /OS X ([0-9._]+)/), new Entity('iOS', /iPhone OS ([0-9_.]+)/), new Entity('iPadOS', /iPad.+?OS ([0-9_,]+)/), new Entity('CrOS', /CrOS [^ ]+ ([0-9.]+)/), new Entity('Android', /(?:Android|Adr) ([0-9.]+)/), new Entity('BlackBerry', /BlackBerry|BB10/), new Entity('webOS', /webOS\/([0-9.]+)/), new Entity('Linux', /Linux/)]; + const platforms = [new Entity('Windows', /Windows NT ([0-9.]+)/), new Entity('Windows Phone', /Windows Phone ([0-9.]+)/), new Entity('MacOS', /OS X ([0-9._]+)/), new Entity('iOS', /iPhone OS ([0-9_.]+)/), new Entity('iPadOS', /iPad.+?OS ([0-9_,]+)/), new Entity('ChromeOS', /CrOS [^ ]+ ([0-9.]+)/), new Entity('Android', /(?:Android|Adr) ([0-9.]+)/), new Entity('BlackBerry', /BlackBerry|BB10/), new Entity('webOS', /webOS\/([0-9.]+)/), new Entity('Linux', /Linux/)]; const BrowserInfo = { os: '?', diff --git a/dist/smartbear-browser-info.js.map b/dist/smartbear-browser-info.js.map index f775dae..0f4122c 100644 --- a/dist/smartbear-browser-info.js.map +++ b/dist/smartbear-browser-info.js.map @@ -1 +1 @@ -{"version":3,"file":"smartbear-browser-info.js","sources":["../src/Entity.js","../src/known-browsers.js","../src/known-platforms.js","../src/BrowserInfo.js"],"sourcesContent":["const MAJOR_VERSION = /^\\d+/;\n\nclass Entity {\n constructor (name, pattern) {\n this.name = name;\n this.pattern = pattern;\n }\n\n match (str) {\n const m = str.match(this.pattern);\n if (m === null) {\n return null;\n }\n\n const info = {\n name: this.name,\n version: null,\n release: null\n };\n\n if (typeof m[1] !== 'undefined') {\n info.version = m[1].replace('_', '.');\n info.release = parseInt(info.version.match(MAJOR_VERSION)[0], 10);\n }\n\n return info;\n }\n}\n\nexport { Entity };\n","import { Entity } from './Entity';\n\nconst browsers = [\n new Entity('Firefox', /Firefox\\/([0-9.]+)/),\n new Entity('Opera', /OPR\\/([0-9.]+)/),\n new Entity('Edge', /Edge\\/([0-9.]+)/),\n new Entity('Maxthon', /Maxthon\\/([0-9.]+)/),\n new Entity('Chrome', /Chrome\\/([0-9.]+)/),\n new Entity('Safari', /Version\\/([0-9.]+) Safari\\//),\n new Entity('InternetExplorer', /MSIE ([0-9.]+)/)\n];\n\nexport { browsers };\n","import { Entity } from './Entity';\n\n// platform:\n// /\\([^)]*?([A-Z][a-z][A-Za-z]+)([A-Za-z0-9_ ]* )([0-9._]+)[;) ]/ 1 - system, 2 - architektura, 3 - wersja\n// /\\([^)]*?[A-Z][a-z][A-Za-z]+[A-Za-z0-9_ ]* [0-9._]+[;)]|\\([^)]*?[A-Z][a-z][A-Za-z0-9 !_]+/\n\nconst platforms = [\n new Entity('Windows', /Windows NT ([0-9.]+)/),\n new Entity('Windows Phone', /Windows Phone ([0-9.]+)/),\n new Entity('MacOS', /OS X ([0-9._]+)/),\n new Entity('iOS', /iPhone OS ([0-9_.]+)/),\n new Entity('iPadOS', /iPad.+?OS ([0-9_,]+)/),\n new Entity('CrOS', /CrOS [^ ]+ ([0-9.]+)/),\n new Entity('Android', /(?:Android|Adr) ([0-9.]+)/),\n new Entity('BlackBerry', /BlackBerry|BB10/),\n new Entity('webOS', /webOS\\/([0-9.]+)/),\n new Entity('Linux', /Linux/)\n];\n\nexport { platforms };\n","import { browsers } from './known-browsers';\nimport { platforms } from './known-platforms';\n\nconst BrowserInfo = {\n os: '?',\n name: '?',\n release: '?',\n version: '?',\n\n detect (userAgent = null) {\n const ua = typeof userAgent === 'string' ? userAgent : window.navigator.userAgent;\n\n let found = false;\n for(const browser of browsers) {\n let match = browser.match(ua);\n\n if (match !== null) {\n this.name = match.name;\n this.release = match.release;\n this.version = match.version;\n found = true;\n break;\n }\n }\n\n for(const platform of platforms) {\n let match = platform.match(ua);\n\n if (match !== null) {\n this.os = match.name;\n break;\n }\n }\n\n return found;\n },\n\n toString () {\n return `${this.name} ${this.versionString}`;\n },\n\n get versionAsString () {\n return `${this.release}.${this.version}`;\n },\n\n get versionAsNumber() {\n return parseInt(this.versionString.replace(/\\./g, ''));\n }\n};\n\nexport { BrowserInfo };\n"],"names":["MAJOR_VERSION","Entity","constructor","name","pattern","match","str","m","info","version","release","replace","parseInt","browsers","platforms","BrowserInfo","os","detect","userAgent","ua","window","navigator","found","browser","platform","toString","versionString","versionAsString","versionAsNumber"],"mappings":";;;;;;;EAAA,MAAMA,aAAa,GAAG,MAAtB;;EAEA,MAAMC,MAAN,CAAa;EACXC,EAAAA,WAAW,CAA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AME,QAAV,IAAsBV,SAAtB,EAAiC;EAC/B,UAAIT,KAAK,GAAGmB,QAAQ,CAACnB,KAAT,CAAec,EAAf,CAAZ;;EAEA,UAAId,KAAK,KAAK,IAAd,EAAoB;EAClB,aAAKW,EAAL,GAAUX,KAAK,CAACF,IAAhB;EACA;EACD;EACF;;EAED,WAAOmB,KAAP;EACD,GAhCiB;;EAkClBG,EAAAA,QAAQ,GAAI;EACV,WAAQ,GAAE,KAAKtB,IAAK,IAAG,KAAKuB,aAAc,EAA1C;EACD,GApCiB;;EAsClB,MAAIC,eAAJ,GAAuB;EACrB,WAAQ,GAAE,KAAKjB,OAAQ,IAAG,KAAKD,OAAQ,EAAvC;EACD,GAxCiB;;EA0ClB,MAAImB,eAAJ,GAAsB;EACpB,WAAOhB,QAAQ,CAAC,KAAKc,aAAL,CAAmBf,OAAnB,CAA2B,KAA3B,EAAkC,EAAlC,CAAD,CAAf;EACD;;EA5CiB;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"smartbear-browser-info.js","sources":["../src/Entity.js","../src/known-browsers.js","../src/known-platforms.js","../src/BrowserInfo.js"],"sourcesContent":["const MAJOR_VERSION = /^\\d+/;\n\nclass Entity {\n constructor (name, pattern) {\n this.name = name;\n this.pattern = pattern;\n }\n\n match (str) {\n const m = str.match(this.pattern);\n if (m === null) {\n return null;\n }\n\n const info = {\n name: this.name,\n version: null,\n release: null\n };\n\n if (typeof m[1] !== 'undefined') {\n info.version = m[1].replace('_', '.');\n info.release = parseInt(info.version.match(MAJOR_VERSION)[0], 10);\n }\n\n return info;\n }\n}\n\nexport { Entity };\n","import { Entity } from './Entity';\n\nconst browsers = [\n new Entity('Firefox', /Firefox\\/([0-9.]+)/),\n new Entity('Opera', /OPR\\/([0-9.]+)/),\n new Entity('Edge', /Edge\\/([0-9.]+)/),\n new Entity('Maxthon', /Maxthon\\/([0-9.]+)/),\n new Entity('Chrome', /Chrome\\/([0-9.]+)/),\n new Entity('Safari', /Version\\/([0-9.]+) Safari\\//),\n new Entity('InternetExplorer', /MSIE ([0-9.]+)/)\n];\n\nexport { browsers };\n","import { Entity } from './Entity';\n\nconst platforms = [\n new Entity('Windows', /Windows NT ([0-9.]+)/),\n new Entity('Windows Phone', /Windows Phone ([0-9.]+)/),\n new Entity('MacOS', /OS X ([0-9._]+)/),\n new Entity('iOS', /iPhone OS ([0-9_.]+)/),\n new Entity('iPadOS', /iPad.+?OS ([0-9_,]+)/),\n new Entity('ChromeOS', /CrOS [^ ]+ ([0-9.]+)/),\n new Entity('Android', /(?:Android|Adr) ([0-9.]+)/),\n new Entity('BlackBerry', /BlackBerry|BB10/),\n new Entity('webOS', /webOS\\/([0-9.]+)/),\n new Entity('Linux', /Linux/)\n];\n\nexport { platforms };\n","import { browsers } from './known-browsers';\nimport { platforms } from './known-platforms';\n\nconst BrowserInfo = {\n os: '?',\n name: '?',\n release: '?',\n version: '?',\n\n detect (userAgent = null) {\n const ua = typeof userAgent === 'string' ? userAgent : window.navigator.userAgent;\n\n let found = false;\n for(const browser of browsers) {\n let match = browser.match(ua);\n\n if (match !== null) {\n this.name = match.name;\n this.release = match.release;\n this.version = match.version;\n found = true;\n break;\n }\n }\n\n for(const platform of platforms) {\n let match = platform.match(ua);\n\n if (match !== null) {\n this.os = match.name;\n break;\n }\n }\n\n return found;\n },\n\n toString () {\n return `${this.name} ${this.versionString}`;\n },\n\n get versionAsString () {\n return `${this.release}.${this.version}`;\n },\n\n get versionAsNumber() {\n return parseInt(this.versionString.replace(/\\./g, ''));\n }\n};\n\nexport { BrowserInfo };\n"],"names":["MAJOR_VERSION","Entity","constructor","name","pattern","match","str","m","info","version","release","replace","parseInt","browsers","platforms","BrowserInfo","os","detect","userAgent","ua","window","navigator","found","browser","platform","toString","versionString","versionAsString","versionAsNumber"],"mappings":";;;;;;;EAAA,MAAMA,aAAa,GAAG,MAAtB;;EAEA,MAAMC,MAAN,CAAa;EACXC,EAAAA,WAAW,CAAEC,IAAF,EAAQC,OAAR,EAAiB;EAC1B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AAK,GAAGmB,QAAQ,CAACnB,KAAT,CAAec,EAAf,CAAZ;;EAEA,UAAId,KAAK,KAAK,IAAd,EAAoB;EAClB,aAAKW,EAAL,GAAUX,KAAK,CAACF,IAAhB;EACA;EACD;EACF;;EAED,WAAOmB,KAAP;EACD,GAhCiB;;EAkClBG,EAAAA,QAAQ,GAAI;EACV,WAAQ,GAAE,KAAKtB,IAAK,IAAG,KAAKuB,aAAc,EAA1C;EACD,GApCiB;;EAsClB,MAAIC,eAAJ,GAAuB;EACrB,WAAQ,GAAE,KAAKjB,OAAQ,IAAG,KAAKD,OAAQ,EAAvC;EACD,GAxCiB;;EA0ClB,MAAImB,eAAJ,GAAsB;EACpB,WAAOhB,QAAQ,CAAC,KAAKc,aAAL,CAAmBf,OAAnB,CAA2B,KAA3B,EAAkC,EAAlC,CAAD,CAAf;EACD;;EA5CiB;;;;;;;;"} \ No newline at end of file diff --git a/dist/smartbear-browser-info.min.js b/dist/smartbear-browser-info.min.js index a01e931..1baecae 100644 --- a/dist/smartbear-browser-info.min.js +++ b/dist/smartbear-browser-info.min.js @@ -1,3 +1,3 @@ -/* @smartbear/browser-info v1.0.0 | Copyright 2020 (c) SmartBear Software and contributors | https://github.com/SmartBear/browser-info/blob/master/LICENSE */ -!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self)["@smartbear/browser-info"]=n()}(this,(function(){"use strict";const e=/^\d+/;class n{constructor(e,n){this.name=e,this.pattern=n}match(n){const r=n.match(this.pattern);if(null===r)return null;const t={name:this.name,version:null,release:null};return void 0!==r[1]&&(t.version=r[1].replace("_","."),t.release=parseInt(t.version.match(e)[0],10)),t}}const r=[new n("Firefox",/Firefox\/([0-9.]+)/),new n("Opera",/OPR\/([0-9.]+)/),new n("Edge",/Edge\/([0-9.]+)/),new n("Maxthon",/Maxthon\/([0-9.]+)/),new n("Chrome",/Chrome\/([0-9.]+)/),new n("Safari",/Version\/([0-9.]+) Safari\//),new n("InternetExplorer",/MSIE ([0-9.]+)/)],t=[new n("Windows",/Windows NT ([0-9.]+)/),new n("Windows Phone",/Windows Phone ([0-9.]+)/),new n("MacOS",/OS X ([0-9._]+)/),new n("iOS",/iPhone OS ([0-9_.]+)/),new n("iPadOS",/iPad.+?OS ([0-9_,]+)/),new n("CrOS",/CrOS [^ ]+ ([0-9.]+)/),new n("Android",/(?:Android|Adr) ([0-9.]+)/),new n("BlackBerry",/BlackBerry|BB10/),new n("webOS",/webOS\/([0-9.]+)/),new n("Linux",/Linux/)];return{os:"?",name:"?",release:"?",version:"?",detect(e=null){const n="string"==typeof e?e:window.navigator.userAgent;let i=!1;for(const e of r){let r=e.match(n);if(null!==r){this.name=r.name,this.release=r.release,this.version=r.version,i=!0;break}}for(const e of t){let r=e.match(n);if(null!==r){this.os=r.name;break}}return i},toString(){return`${this.name} ${this.versionString}`},get versionAsString(){return`${this.release}.${this.version}`},get versionAsNumber(){return parseInt(this.versionString.replace(/\./g,""))}}})); +/* @smartbear/browser-info v1.0.1 | Copyright 2020 (c) SmartBear Software and contributors | https://github.com/SmartBear/browser-info/blob/master/LICENSE */ +!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self)["@smartbear/browser-info"]=n()}(this,(function(){"use strict";const e=/^\d+/;class n{constructor(e,n){this.name=e,this.pattern=n}match(n){const r=n.match(this.pattern);if(null===r)return null;const t={name:this.name,version:null,release:null};return void 0!==r[1]&&(t.version=r[1].replace("_","."),t.release=parseInt(t.version.match(e)[0],10)),t}}const r=[new n("Firefox",/Firefox\/([0-9.]+)/),new n("Opera",/OPR\/([0-9.]+)/),new n("Edge",/Edge\/([0-9.]+)/),new n("Maxthon",/Maxthon\/([0-9.]+)/),new n("Chrome",/Chrome\/([0-9.]+)/),new n("Safari",/Version\/([0-9.]+) Safari\//),new n("InternetExplorer",/MSIE ([0-9.]+)/)],t=[new n("Windows",/Windows NT ([0-9.]+)/),new n("Windows Phone",/Windows Phone ([0-9.]+)/),new n("MacOS",/OS X ([0-9._]+)/),new n("iOS",/iPhone OS ([0-9_.]+)/),new n("iPadOS",/iPad.+?OS ([0-9_,]+)/),new n("ChromeOS",/CrOS [^ ]+ ([0-9.]+)/),new n("Android",/(?:Android|Adr) ([0-9.]+)/),new n("BlackBerry",/BlackBerry|BB10/),new n("webOS",/webOS\/([0-9.]+)/),new n("Linux",/Linux/)];return{os:"?",name:"?",release:"?",version:"?",detect(e=null){const n="string"==typeof e?e:window.navigator.userAgent;let i=!1;for(const e of r){let r=e.match(n);if(null!==r){this.name=r.name,this.release=r.release,this.version=r.version,i=!0;break}}for(const e of t){let r=e.match(n);if(null!==r){this.os=r.name;break}}return i},toString(){return`${this.name} ${this.versionString}`},get versionAsString(){return`${this.release}.${this.version}`},get versionAsNumber(){return parseInt(this.versionString.replace(/\./g,""))}}})); //# sourceMappingURL=smartbear-browser-info.min.js.map diff --git a/dist/smartbear-browser-info.min.js.map b/dist/smartbear-browser-info.min.js.map index 0550dd9..469f88a 100644 --- a/dist/smartbear-browser-info.min.js.map +++ b/dist/smartbear-browser-info.min.js.map @@ -1 +1 @@ -{"version":3,"file":"smartbear-browser-info.min.js","sources":["../src/Entity.js","../src/known-browsers.js","../src/known-platforms.js","../src/BrowserInfo.js"],"sourcesContent":["const MAJOR_VERSION = /^\\d+/;\n\nclass Entity {\n constructor (name, pattern) {\n this.name = name;\n this.pattern = pattern;\n }\n\n match (str) {\n const m = str.match(this.pattern);\n if (m === null) {\n return null;\n }\n\n const info = {\n name: this.name,\n version: null,\n release: null\n };\n\n if (typeof m[1] !== 'undefined') {\n info.version = m[1].replace('_', '.');\n info.release = parseInt(info.version.match(MAJOR_VERSION)[0], 10);\n }\n\n return info;\n }\n}\n\nexport { Entity };\n","import { Entity } from './Entity';\n\nconst browsers = [\n new Entity('Firefox', /Firefox\\/([0-9.]+)/),\n new Entity('Opera', /OPR\\/([0-9.]+)/),\n new Entity('Edge', /Edge\\/([0-9.]+)/),\n new Entity('Maxthon', /Maxthon\\/([0-9.]+)/),\n new Entity('Chrome', /Chrome\\/([0-9.]+)/),\n new Entity('Safari', /Version\\/([0-9.]+) Safari\\//),\n new Entity('InternetExplorer', /MSIE ([0-9.]+)/)\n];\n\nexport { browsers };\n","import { Entity } from './Entity';\n\n// platform:\n// /\\([^)]*?([A-Z][a-z][A-Za-z]+)([A-Za-z0-9_ ]* )([0-9._]+)[;) ]/ 1 - system, 2 - architektura, 3 - wersja\n// /\\([^)]*?[A-Z][a-z][A-Za-z]+[A-Za-z0-9_ ]* [0-9._]+[;)]|\\([^)]*?[A-Z][a-z][A-Za-z0-9 !_]+/\n\nconst platforms = [\n new Entity('Windows', /Windows NT ([0-9.]+)/),\n new Entity('Windows Phone', /Windows Phone ([0-9.]+)/),\n new Entity('MacOS', /OS X ([0-9._]+)/),\n new Entity('iOS', /iPhone OS ([0-9_.]+)/),\n new Entity('iPadOS', /iPad.+?OS ([0-9_,]+)/),\n new Entity('CrOS', /CrOS [^ ]+ ([0-9.]+)/),\n new Entity('Android', /(?:Android|Adr) ([0-9.]+)/),\n new Entity('BlackBerry', /BlackBerry|BB10/),\n new Entity('webOS', /webOS\\/([0-9.]+)/),\n new Entity('Linux', /Linux/)\n];\n\nexport { platforms };\n","import { browsers } from './known-browsers';\nimport { platforms } from './known-platforms';\n\nconst BrowserInfo = {\n os: '?',\n name: '?',\n release: '?',\n version: '?',\n\n detect (userAgent = null) {\n const ua = typeof userAgent === 'string' ? userAgent : window.navigator.userAgent;\n\n let found = false;\n for(const browser of browsers) {\n let match = browser.match(ua);\n\n if (match !== null) {\n this.name = match.name;\n this.release = match.release;\n this.version = match.version;\n found = true;\n break;\n }\n }\n\n for(const platform of platforms) {\n let match = platform.match(ua);\n\n if (match !== null) {\n this.os = match.name;\n break;\n }\n }\n\n return found;\n },\n\n toString () {\n return `${this.name} ${this.versionString}`;\n },\n\n get versionAsString () {\n return `${this.release}.${this.version}`;\n },\n\n get versionAsNumber() {\n return parseInt(this.versionString.replace(/\\./g, ''));\n }\n};\n\nexport { BrowserInfo };\n"],"names":["MAJOR_VERSION","Entity","constructor","name","pattern","match","str","m","this","info","version","release","replace","parseInt","browsers","platforms","os","detect","userAgent","ua","window","navigator","found","browser","platform","toString","versionString"],"mappings":";2PAAA,MAAMA,EAAgB,OAEtB,MAAMC,EACJC,YAAaC,EAAMC,QACZD,KAAOA,OACPC,QAAUA,EAGjBC,MAAOC,SACCC,EAAID,EAAID,MAAMG,KAAKJ,YACf,OAANG,SACK,WAGHE,EAAO,CACXN,KAAMK,KAAKL,KACXO,QAAS,KACTC,QAAS,kBAGS,IAATJ,EAAE,KACXE,EAAKC,QAAUH,EAAE,GAAGK,QAAQ,IAAK,KACjCH,EAAKE,QAAUE,SAASJ,EAAKC,QAAQL,MAAML,GAAe,GAAI,KAGzDS,GCvBX,MAAMK,EAAW,CACf,IAAIb,EAAO,UAAW,sBACtB,IAAIA,EAAO,QAAS,kBACpB,IAAIA,EAAO,OAAQ,mBACnB,IAAIA,EAAO,UAAW,sBACtB,IAAIA,EAAO,SAAU,qBACrB,IAAIA,EAAO,SAAU,+BACrB,IAAIA,EAAO,mBAAoB,mBCH3Bc,EAAY,CAChB,IAAId,EAAO,UAAW,wBACtB,IAAIA,EAAO,gBAAiB,2BAC5B,IAAIA,EAAO,QAAS,mBACpB,IAAIA,EAAO,MAAO,wBAClB,IAAIA,EAAO,SAAU,wBACrB,IAAIA,EAAO,OAAQ,wBACnB,IAAIA,EAAO,UAAW,6BACtB,IAAIA,EAAO,aAAc,mBACzB,IAAIA,EAAO,QAAS,oBACpB,IAAIA,EAAO,QAAS,gBCbF,CAClBe,GAAI,IACJb,KAAM,IACNQ,QAAS,IACTD,QAAS,IAETO,OAAQC,EAAY,YACZC,EAA0B,iBAAdD,EAAyBA,EAAYE,OAAOC,UAAUH,cAEpEI,GAAQ,MACR,MAAMC,KAAWT,EAAU,KACzBT,EAAQkB,EAAQlB,MAAMc,MAEZ,OAAVd,EAAgB,MACbF,KAAOE,EAAMF,UACbQ,QAAUN,EAAMM,aAChBD,QAAUL,EAAMK,QACrBY,GAAQ,aAKR,MAAME,KAAYT,EAAW,KAC3BV,EAAQmB,EAASnB,MAAMc,MAEb,OAAVd,EAAgB,MACbW,GAAKX,EAAMF,mBAKbmB,GAGTG,iBACU,GAAEjB,KAAKL,QAAQK,KAAKkB,6CAIpB,GAAElB,KAAKG,WAAWH,KAAKE,wCAIxBG,SAASL,KAAKkB,cAAcd,QAAQ,MAAO"} \ No newline at end of file +{"version":3,"file":"smartbear-browser-info.min.js","sources":["../src/Entity.js","../src/known-browsers.js","../src/known-platforms.js","../src/BrowserInfo.js"],"sourcesContent":["const MAJOR_VERSION = /^\\d+/;\n\nclass Entity {\n constructor (name, pattern) {\n this.name = name;\n this.pattern = pattern;\n }\n\n match (str) {\n const m = str.match(this.pattern);\n if (m === null) {\n return null;\n }\n\n const info = {\n name: this.name,\n version: null,\n release: null\n };\n\n if (typeof m[1] !== 'undefined') {\n info.version = m[1].replace('_', '.');\n info.release = parseInt(info.version.match(MAJOR_VERSION)[0], 10);\n }\n\n return info;\n }\n}\n\nexport { Entity };\n","import { Entity } from './Entity';\n\nconst browsers = [\n new Entity('Firefox', /Firefox\\/([0-9.]+)/),\n new Entity('Opera', /OPR\\/([0-9.]+)/),\n new Entity('Edge', /Edge\\/([0-9.]+)/),\n new Entity('Maxthon', /Maxthon\\/([0-9.]+)/),\n new Entity('Chrome', /Chrome\\/([0-9.]+)/),\n new Entity('Safari', /Version\\/([0-9.]+) Safari\\//),\n new Entity('InternetExplorer', /MSIE ([0-9.]+)/)\n];\n\nexport { browsers };\n","import { Entity } from './Entity';\n\nconst platforms = [\n new Entity('Windows', /Windows NT ([0-9.]+)/),\n new Entity('Windows Phone', /Windows Phone ([0-9.]+)/),\n new Entity('MacOS', /OS X ([0-9._]+)/),\n new Entity('iOS', /iPhone OS ([0-9_.]+)/),\n new Entity('iPadOS', /iPad.+?OS ([0-9_,]+)/),\n new Entity('ChromeOS', /CrOS [^ ]+ ([0-9.]+)/),\n new Entity('Android', /(?:Android|Adr) ([0-9.]+)/),\n new Entity('BlackBerry', /BlackBerry|BB10/),\n new Entity('webOS', /webOS\\/([0-9.]+)/),\n new Entity('Linux', /Linux/)\n];\n\nexport { platforms };\n","import { browsers } from './known-browsers';\nimport { platforms } from './known-platforms';\n\nconst BrowserInfo = {\n os: '?',\n name: '?',\n release: '?',\n version: '?',\n\n detect (userAgent = null) {\n const ua = typeof userAgent === 'string' ? userAgent : window.navigator.userAgent;\n\n let found = false;\n for(const browser of browsers) {\n let match = browser.match(ua);\n\n if (match !== null) {\n this.name = match.name;\n this.release = match.release;\n this.version = match.version;\n found = true;\n break;\n }\n }\n\n for(const platform of platforms) {\n let match = platform.match(ua);\n\n if (match !== null) {\n this.os = match.name;\n break;\n }\n }\n\n return found;\n },\n\n toString () {\n return `${this.name} ${this.versionString}`;\n },\n\n get versionAsString () {\n return `${this.release}.${this.version}`;\n },\n\n get versionAsNumber() {\n return parseInt(this.versionString.replace(/\\./g, ''));\n }\n};\n\nexport { BrowserInfo };\n"],"names":["MAJOR_VERSION","Entity","constructor","name","pattern","match","str","m","this","info","version","release","replace","parseInt","browsers","platforms","os","detect","userAgent","ua","window","navigator","found","browser","platform","toString","versionString"],"mappings":";2PAAA,MAAMA,EAAgB,OAEtB,MAAMC,EACJC,YAAaC,EAAMC,QACZD,KAAOA,OACPC,QAAUA,EAGjBC,MAAOC,SACCC,EAAID,EAAID,MAAMG,KAAKJ,YACf,OAANG,SACK,WAGHE,EAAO,CACXN,KAAMK,KAAKL,KACXO,QAAS,KACTC,QAAS,kBAGS,IAATJ,EAAE,KACXE,EAAKC,QAAUH,EAAE,GAAGK,QAAQ,IAAK,KACjCH,EAAKE,QAAUE,SAASJ,EAAKC,QAAQL,MAAML,GAAe,GAAI,KAGzDS,GCvBX,MAAMK,EAAW,CACf,IAAIb,EAAO,UAAW,sBACtB,IAAIA,EAAO,QAAS,kBACpB,IAAIA,EAAO,OAAQ,mBACnB,IAAIA,EAAO,UAAW,sBACtB,IAAIA,EAAO,SAAU,qBACrB,IAAIA,EAAO,SAAU,+BACrB,IAAIA,EAAO,mBAAoB,mBCP3Bc,EAAY,CAChB,IAAId,EAAO,UAAW,wBACtB,IAAIA,EAAO,gBAAiB,2BAC5B,IAAIA,EAAO,QAAS,mBACpB,IAAIA,EAAO,MAAO,wBAClB,IAAIA,EAAO,SAAU,wBACrB,IAAIA,EAAO,WAAY,wBACvB,IAAIA,EAAO,UAAW,6BACtB,IAAIA,EAAO,aAAc,mBACzB,IAAIA,EAAO,QAAS,oBACpB,IAAIA,EAAO,QAAS,gBCTF,CAClBe,GAAI,IACJb,KAAM,IACNQ,QAAS,IACTD,QAAS,IAETO,OAAQC,EAAY,YACZC,EAA0B,iBAAdD,EAAyBA,EAAYE,OAAOC,UAAUH,cAEpEI,GAAQ,MACR,MAAMC,KAAWT,EAAU,KACzBT,EAAQkB,EAAQlB,MAAMc,MAEZ,OAAVd,EAAgB,MACbF,KAAOE,EAAMF,UACbQ,QAAUN,EAAMM,aAChBD,QAAUL,EAAMK,QACrBY,GAAQ,aAKR,MAAME,KAAYT,EAAW,KAC3BV,EAAQmB,EAASnB,MAAMc,MAEb,OAAVd,EAAgB,MACbW,GAAKX,EAAMF,mBAKbmB,GAGTG,iBACU,GAAEjB,KAAKL,QAAQK,KAAKkB,6CAIpB,GAAElB,KAAKG,WAAWH,KAAKE,wCAIxBG,SAASL,KAAKkB,cAAcd,QAAQ,MAAO"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 81b3e14..d390474 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@smartbear/browser-info", - "version": "1.0.0", + "version": "1.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 5735b11..be0b516 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@smartbear/browser-info", - "version": "1.0.0", + "version": "1.0.1", "description": "Tiny developer-friendly JS library that provides information about host browser", "main": "dist/smartbear-browser-info.min.js", "scripts": {