1
0
mirror of https://github.com/lancedikson/bowser synced 2024-10-27 20:34:22 +00:00

Merge pull request #294 from FostUK/es6-import-extensions

Add file extensions to imports
This commit is contained in:
Denis Demchenko 2019-03-02 16:31:39 +02:00 committed by GitHub
commit a81b8c0ed7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 88 additions and 141 deletions

View File

@ -3,6 +3,11 @@ extends: airbnb-base
rules: rules:
no-underscore-dangle: 0 no-underscore-dangle: 0
no-void: 0 no-void: 0
import/extensions:
- 'error'
- 'ignorePackages'
- {js: 'always'}
plugins: plugins:
- ava - ava
- import - import

77
package-lock.json generated
View File

@ -86,8 +86,7 @@
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz",
"integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==",
"dev": true, "dev": true
"optional": true
}, },
"array-unique": { "array-unique": {
"version": "0.3.2", "version": "0.3.2",
@ -101,7 +100,6 @@
"resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz",
"integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"arr-flatten": "^1.1.0", "arr-flatten": "^1.1.0",
"array-unique": "^0.3.2", "array-unique": "^0.3.2",
@ -120,7 +118,6 @@
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"is-extendable": "^0.1.0" "is-extendable": "^0.1.0"
} }
@ -304,7 +301,6 @@
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz",
"integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"extend-shallow": "^2.0.1", "extend-shallow": "^2.0.1",
"is-number": "^3.0.0", "is-number": "^3.0.0",
@ -317,7 +313,6 @@
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"is-extendable": "^0.1.0" "is-extendable": "^0.1.0"
} }
@ -997,8 +992,7 @@
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
"integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=",
"dev": true, "dev": true
"optional": true
}, },
"is-glob": { "is-glob": {
"version": "4.0.0", "version": "4.0.0",
@ -1015,7 +1009,6 @@
"resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz",
"integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"kind-of": "^3.0.2" "kind-of": "^3.0.2"
}, },
@ -1025,7 +1018,6 @@
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
"integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"is-buffer": "^1.1.5" "is-buffer": "^1.1.5"
} }
@ -1036,15 +1028,13 @@
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
"integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=",
"dev": true, "dev": true
"optional": true
}, },
"kind-of": { "kind-of": {
"version": "6.0.2", "version": "6.0.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz",
"integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==",
"dev": true, "dev": true
"optional": true
}, },
"lodash": { "lodash": {
"version": "4.17.11", "version": "4.17.11",
@ -5177,8 +5167,7 @@
"version": "1.1.0", "version": "1.1.0",
"resolved": false, "resolved": false,
"integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=",
"dev": true, "dev": true
"optional": true
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
@ -5358,7 +5347,6 @@
"resolved": false, "resolved": false,
"integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==", "integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"safe-buffer": "^5.1.1", "safe-buffer": "^5.1.1",
"yallist": "^3.0.0" "yallist": "^3.0.0"
@ -5379,7 +5367,6 @@
"resolved": false, "resolved": false,
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "0.0.8"
} }
@ -5483,7 +5470,6 @@
"resolved": false, "resolved": false,
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1"
} }
@ -5622,7 +5608,6 @@
"resolved": false, "resolved": false,
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0", "is-fullwidth-code-point": "^1.0.0",
@ -6242,15 +6227,13 @@
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz",
"integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=",
"dev": true, "dev": true
"optional": true
}, },
"arr-flatten": { "arr-flatten": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz",
"integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==",
"dev": true, "dev": true
"optional": true
}, },
"array-unique": { "array-unique": {
"version": "0.3.2", "version": "0.3.2",
@ -6278,7 +6261,6 @@
"resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz",
"integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"arr-flatten": "^1.1.0", "arr-flatten": "^1.1.0",
"array-unique": "^0.3.2", "array-unique": "^0.3.2",
@ -6297,7 +6279,6 @@
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"is-extendable": "^0.1.0" "is-extendable": "^0.1.0"
} }
@ -6331,7 +6312,6 @@
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"ms": "2.0.0" "ms": "2.0.0"
} }
@ -6341,7 +6321,6 @@
"resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz",
"integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"debug": "^2.3.3", "debug": "^2.3.3",
"define-property": "^0.2.5", "define-property": "^0.2.5",
@ -6357,7 +6336,6 @@
"resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
"integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"is-descriptor": "^0.1.0" "is-descriptor": "^0.1.0"
} }
@ -6367,7 +6345,6 @@
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"is-extendable": "^0.1.0" "is-extendable": "^0.1.0"
} }
@ -6377,7 +6354,6 @@
"resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz",
"integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"kind-of": "^3.0.2" "kind-of": "^3.0.2"
}, },
@ -6387,7 +6363,6 @@
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
"integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"is-buffer": "^1.1.5" "is-buffer": "^1.1.5"
} }
@ -6399,7 +6374,6 @@
"resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz",
"integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"kind-of": "^3.0.2" "kind-of": "^3.0.2"
}, },
@ -6409,7 +6383,6 @@
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
"integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"is-buffer": "^1.1.5" "is-buffer": "^1.1.5"
} }
@ -6421,7 +6394,6 @@
"resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz",
"integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"is-accessor-descriptor": "^0.1.6", "is-accessor-descriptor": "^0.1.6",
"is-data-descriptor": "^0.1.4", "is-data-descriptor": "^0.1.4",
@ -6432,8 +6404,7 @@
"version": "5.1.0", "version": "5.1.0",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz",
"integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==",
"dev": true, "dev": true
"optional": true
} }
} }
}, },
@ -6442,7 +6413,6 @@
"resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz",
"integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"array-unique": "^0.3.2", "array-unique": "^0.3.2",
"define-property": "^1.0.0", "define-property": "^1.0.0",
@ -6459,7 +6429,6 @@
"resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz",
"integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"is-descriptor": "^1.0.0" "is-descriptor": "^1.0.0"
} }
@ -6469,7 +6438,6 @@
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"is-extendable": "^0.1.0" "is-extendable": "^0.1.0"
} }
@ -6481,7 +6449,6 @@
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz",
"integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"extend-shallow": "^2.0.1", "extend-shallow": "^2.0.1",
"is-number": "^3.0.0", "is-number": "^3.0.0",
@ -6494,7 +6461,6 @@
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"is-extendable": "^0.1.0" "is-extendable": "^0.1.0"
} }
@ -6768,7 +6734,6 @@
"resolved": false, "resolved": false,
"integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==", "integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"safe-buffer": "^5.1.1", "safe-buffer": "^5.1.1",
"yallist": "^3.0.0" "yallist": "^3.0.0"
@ -6789,7 +6754,6 @@
"resolved": false, "resolved": false,
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "0.0.8"
} }
@ -7143,7 +7107,6 @@
"resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
"integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"kind-of": "^6.0.0" "kind-of": "^6.0.0"
} }
@ -7170,7 +7133,6 @@
"resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz",
"integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"kind-of": "^6.0.0" "kind-of": "^6.0.0"
} }
@ -7180,7 +7142,6 @@
"resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz",
"integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"is-accessor-descriptor": "^1.0.0", "is-accessor-descriptor": "^1.0.0",
"is-data-descriptor": "^1.0.0", "is-data-descriptor": "^1.0.0",
@ -7198,8 +7159,7 @@
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
"integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=",
"dev": true, "dev": true
"optional": true
}, },
"is-glob": { "is-glob": {
"version": "4.0.0", "version": "4.0.0",
@ -7216,7 +7176,6 @@
"resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz",
"integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"kind-of": "^3.0.2" "kind-of": "^3.0.2"
}, },
@ -7226,7 +7185,6 @@
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
"integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"is-buffer": "^1.1.5" "is-buffer": "^1.1.5"
} }
@ -7237,8 +7195,7 @@
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
"integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=",
"dev": true, "dev": true
"optional": true
}, },
"kind-of": { "kind-of": {
"version": "6.0.2", "version": "6.0.2",
@ -7252,7 +7209,6 @@
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz",
"integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"arr-diff": "^4.0.0", "arr-diff": "^4.0.0",
"array-unique": "^0.3.2", "array-unique": "^0.3.2",
@ -7273,8 +7229,7 @@
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"dev": true, "dev": true
"optional": true
}, },
"nan": { "nan": {
"version": "2.11.0", "version": "2.11.0",
@ -7288,7 +7243,6 @@
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz",
"integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"remove-trailing-separator": "^1.0.1" "remove-trailing-separator": "^1.0.1"
} }
@ -7309,22 +7263,19 @@
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz",
"integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=",
"dev": true, "dev": true
"optional": true
}, },
"repeat-element": { "repeat-element": {
"version": "1.1.3", "version": "1.1.3",
"resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz",
"integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==",
"dev": true, "dev": true
"optional": true
}, },
"repeat-string": { "repeat-string": {
"version": "1.6.1", "version": "1.6.1",
"resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz",
"integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=",
"dev": true, "dev": true
"optional": true
} }
} }
}, },

View File

@ -4,7 +4,7 @@
* MIT License | (c) Dustin Diaz 2012-2015 * MIT License | (c) Dustin Diaz 2012-2015
* MIT License | (c) Denis Demchenko 2015-2017 * MIT License | (c) Denis Demchenko 2015-2017
*/ */
import Parser from './parser'; import Parser from './parser.js';
/** /**
* Bowser class. * Bowser class.

View File

@ -23,10 +23,7 @@
* return true/false to get the Parser know if this browser descriptor matches the UA or not. * return true/false to get the Parser know if this browser descriptor matches the UA or not.
*/ */
import { import Utils from './utils.js';
getFirstMatch,
getSecondMatch,
} from './utils';
const commonVersionIdentifier = /version\/(\d+(\.?_?\d+)+)/i; const commonVersionIdentifier = /version\/(\d+(\.?_?\d+)+)/i;
@ -38,7 +35,7 @@ const browsersList = [
const browser = { const browser = {
name: 'Googlebot', name: 'Googlebot',
}; };
const version = getFirstMatch(/googlebot\/(\d+(\.\d+))/i, ua) || getFirstMatch(commonVersionIdentifier, ua); const version = Utils.getFirstMatch(/googlebot\/(\d+(\.\d+))/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -55,7 +52,7 @@ const browsersList = [
const browser = { const browser = {
name: 'Opera', name: 'Opera',
}; };
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i, ua); const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -72,7 +69,7 @@ const browsersList = [
const browser = { const browser = {
name: 'Opera', name: 'Opera',
}; };
const version = getFirstMatch(/(?:opr|opios)[\s/](\S+)/i, ua) || getFirstMatch(commonVersionIdentifier, ua); const version = Utils.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -87,7 +84,7 @@ const browsersList = [
const browser = { const browser = {
name: 'Samsung Internet for Android', name: 'Samsung Internet for Android',
}; };
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i, ua); const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -102,7 +99,7 @@ const browsersList = [
const browser = { const browser = {
name: 'NAVER Whale Browser', name: 'NAVER Whale Browser',
}; };
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i, ua); const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -117,7 +114,7 @@ const browsersList = [
const browser = { const browser = {
name: 'MZ Browser', name: 'MZ Browser',
}; };
const version = getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i, ua) || getFirstMatch(commonVersionIdentifier, ua); const version = Utils.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -132,7 +129,7 @@ const browsersList = [
const browser = { const browser = {
name: 'Focus', name: 'Focus',
}; };
const version = getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i, ua) || getFirstMatch(commonVersionIdentifier, ua); const version = Utils.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -147,7 +144,7 @@ const browsersList = [
const browser = { const browser = {
name: 'Swing', name: 'Swing',
}; };
const version = getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i, ua) || getFirstMatch(commonVersionIdentifier, ua); const version = Utils.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -162,7 +159,7 @@ const browsersList = [
const browser = { const browser = {
name: 'Opera Coast', name: 'Opera Coast',
}; };
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i, ua); const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -177,7 +174,7 @@ const browsersList = [
const browser = { const browser = {
name: 'Yandex Browser', name: 'Yandex Browser',
}; };
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i, ua); const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -192,7 +189,7 @@ const browsersList = [
const browser = { const browser = {
name: 'UC Browser', name: 'UC Browser',
}; };
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i, ua); const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -207,7 +204,7 @@ const browsersList = [
const browser = { const browser = {
name: 'Maxthon', name: 'Maxthon',
}; };
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i, ua); const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -222,7 +219,7 @@ const browsersList = [
const browser = { const browser = {
name: 'Epiphany', name: 'Epiphany',
}; };
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i, ua); const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -237,7 +234,7 @@ const browsersList = [
const browser = { const browser = {
name: 'Puffin', name: 'Puffin',
}; };
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i, ua); const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -252,7 +249,7 @@ const browsersList = [
const browser = { const browser = {
name: 'Sleipnir', name: 'Sleipnir',
}; };
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i, ua); const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -267,7 +264,7 @@ const browsersList = [
const browser = { const browser = {
name: 'K-Meleon', name: 'K-Meleon',
}; };
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i, ua); const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -282,7 +279,7 @@ const browsersList = [
const browser = { const browser = {
name: 'WeChat', name: 'WeChat',
}; };
const version = getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i, ua) || getFirstMatch(commonVersionIdentifier, ua); const version = Utils.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -297,7 +294,7 @@ const browsersList = [
const browser = { const browser = {
name: 'Internet Explorer', name: 'Internet Explorer',
}; };
const version = getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i, ua); const version = Utils.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -313,7 +310,7 @@ const browsersList = [
name: 'Microsoft Edge', name: 'Microsoft Edge',
}; };
const version = getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i, ua); const version = Utils.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -328,7 +325,7 @@ const browsersList = [
const browser = { const browser = {
name: 'Vivaldi', name: 'Vivaldi',
}; };
const version = getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i, ua); const version = Utils.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -343,7 +340,7 @@ const browsersList = [
const browser = { const browser = {
name: 'SeaMonkey', name: 'SeaMonkey',
}; };
const version = getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i, ua); const version = Utils.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -359,7 +356,7 @@ const browsersList = [
name: 'Sailfish', name: 'Sailfish',
}; };
const version = getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i, ua); const version = Utils.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -374,7 +371,7 @@ const browsersList = [
const browser = { const browser = {
name: 'Amazon Silk', name: 'Amazon Silk',
}; };
const version = getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i, ua); const version = Utils.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -389,7 +386,7 @@ const browsersList = [
const browser = { const browser = {
name: 'PhantomJS', name: 'PhantomJS',
}; };
const version = getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i, ua); const version = Utils.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -404,7 +401,7 @@ const browsersList = [
const browser = { const browser = {
name: 'SlimerJS', name: 'SlimerJS',
}; };
const version = getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i, ua); const version = Utils.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -419,7 +416,7 @@ const browsersList = [
const browser = { const browser = {
name: 'BlackBerry', name: 'BlackBerry',
}; };
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i, ua); const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -434,7 +431,7 @@ const browsersList = [
const browser = { const browser = {
name: 'WebOS Browser', name: 'WebOS Browser',
}; };
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i, ua); const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -449,7 +446,7 @@ const browsersList = [
const browser = { const browser = {
name: 'Bada', name: 'Bada',
}; };
const version = getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i, ua); const version = Utils.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -464,7 +461,7 @@ const browsersList = [
const browser = { const browser = {
name: 'Tizen', name: 'Tizen',
}; };
const version = getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i, ua) || getFirstMatch(commonVersionIdentifier, ua); const version = Utils.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -479,7 +476,7 @@ const browsersList = [
const browser = { const browser = {
name: 'QupZilla', name: 'QupZilla',
}; };
const version = getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i, ua) || getFirstMatch(commonVersionIdentifier, ua); const version = Utils.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -494,7 +491,7 @@ const browsersList = [
const browser = { const browser = {
name: 'Firefox', name: 'Firefox',
}; };
const version = getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i, ua); const version = Utils.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -509,7 +506,7 @@ const browsersList = [
const browser = { const browser = {
name: 'Chromium', name: 'Chromium',
}; };
const version = getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i, ua) || getFirstMatch(commonVersionIdentifier, ua); const version = Utils.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -524,7 +521,7 @@ const browsersList = [
const browser = { const browser = {
name: 'Chrome', name: 'Chrome',
}; };
const version = getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i, ua); const version = Utils.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -545,7 +542,7 @@ const browsersList = [
const browser = { const browser = {
name: 'Android Browser', name: 'Android Browser',
}; };
const version = getFirstMatch(commonVersionIdentifier, ua); const version = Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -562,7 +559,7 @@ const browsersList = [
const browser = { const browser = {
name: 'Safari', name: 'Safari',
}; };
const version = getFirstMatch(commonVersionIdentifier, ua); const version = Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) { if (version) {
browser.version = version; browser.version = version;
@ -577,8 +574,8 @@ const browsersList = [
test: [/.*/i], test: [/.*/i],
describe(ua) { describe(ua) {
return { return {
name: getFirstMatch(/^(.*)\/(.*) /, ua), name: Utils.getFirstMatch(/^(.*)\/(.*) /, ua),
version: getSecondMatch(/^(.*)\/(.*) /, ua), version: Utils.getSecondMatch(/^(.*)\/(.*) /, ua),
}; };
}, },
}, },

View File

@ -1,4 +1,4 @@
import { getFirstMatch } from './utils'; import Utils from './utils.js';
/* /*
* More specific goes first * More specific goes first
@ -10,7 +10,7 @@ export default [
return parser.getBrowserName(true) === 'microsoft edge'; return parser.getBrowserName(true) === 'microsoft edge';
}, },
describe(ua) { describe(ua) {
const version = getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i, ua); const version = Utils.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i, ua);
return { return {
name: 'EdgeHTML', name: 'EdgeHTML',
version, version,
@ -26,7 +26,7 @@ export default [
name: 'Trident', name: 'Trident',
}; };
const version = getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i, ua); const version = Utils.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i, ua);
if (version) { if (version) {
engine.version = version; engine.version = version;
@ -46,7 +46,7 @@ export default [
name: 'Presto', name: 'Presto',
}; };
const version = getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i, ua); const version = Utils.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i, ua);
if (version) { if (version) {
engine.version = version; engine.version = version;
@ -68,7 +68,7 @@ export default [
name: 'Gecko', name: 'Gecko',
}; };
const version = getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i, ua); const version = Utils.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i, ua);
if (version) { if (version) {
engine.version = version; engine.version = version;
@ -96,7 +96,7 @@ export default [
name: 'WebKit', name: 'WebKit',
}; };
const version = getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i, ua); const version = Utils.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i, ua);
if (version) { if (version) {
engine.version = version; engine.version = version;

View File

@ -1,15 +1,11 @@
import { import Utils from './utils.js';
getFirstMatch,
getWindowsVersionName,
getAndroidVersionName,
} from './utils';
export default [ export default [
/* Windows Phone */ /* Windows Phone */
{ {
test: [/windows phone/i], test: [/windows phone/i],
describe(ua) { describe(ua) {
const version = getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i, ua); const version = Utils.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i, ua);
return { return {
name: 'Windows Phone', name: 'Windows Phone',
version, version,
@ -21,8 +17,8 @@ export default [
{ {
test: [/windows/i], test: [/windows/i],
describe(ua) { describe(ua) {
const version = getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i, ua); const version = Utils.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i, ua);
const versionName = getWindowsVersionName(version); const versionName = Utils.getWindowsVersionName(version);
return { return {
name: 'Windows', name: 'Windows',
@ -36,7 +32,7 @@ export default [
{ {
test: [/macintosh/i], test: [/macintosh/i],
describe(ua) { describe(ua) {
const version = getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i, ua).replace(/[_\s]/g, '.'); const version = Utils.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i, ua).replace(/[_\s]/g, '.');
return { return {
name: 'macOS', name: 'macOS',
version, version,
@ -48,7 +44,7 @@ export default [
{ {
test: [/(ipod|iphone|ipad)/i], test: [/(ipod|iphone|ipad)/i],
describe(ua) { describe(ua) {
const version = getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i, ua).replace(/[_\s]/g, '.'); const version = Utils.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i, ua).replace(/[_\s]/g, '.');
return { return {
name: 'iOS', name: 'iOS',
@ -65,8 +61,8 @@ export default [
return notLikeAndroid && butAndroid; return notLikeAndroid && butAndroid;
}, },
describe(ua) { describe(ua) {
const version = getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i, ua); const version = Utils.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i, ua);
const versionName = getAndroidVersionName(version); const versionName = Utils.getAndroidVersionName(version);
const os = { const os = {
name: 'Android', name: 'Android',
version, version,
@ -82,7 +78,7 @@ export default [
{ {
test: [/(web|hpw)[o0]s/i], test: [/(web|hpw)[o0]s/i],
describe(ua) { describe(ua) {
const version = getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i, ua); const version = Utils.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i, ua);
const os = { const os = {
name: 'WebOS', name: 'WebOS',
}; };
@ -98,9 +94,9 @@ export default [
{ {
test: [/blackberry|\bbb\d+/i, /rim\stablet/i], test: [/blackberry|\bbb\d+/i, /rim\stablet/i],
describe(ua) { describe(ua) {
const version = getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i, ua) const version = Utils.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i, ua)
|| getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i, ua) || Utils.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i, ua)
|| getFirstMatch(/\bbb(\d+)/i, ua); || Utils.getFirstMatch(/\bbb(\d+)/i, ua);
return { return {
name: 'BlackBerry', name: 'BlackBerry',
@ -113,7 +109,7 @@ export default [
{ {
test: [/bada/i], test: [/bada/i],
describe(ua) { describe(ua) {
const version = getFirstMatch(/bada\/(\d+(\.\d+)*)/i, ua); const version = Utils.getFirstMatch(/bada\/(\d+(\.\d+)*)/i, ua);
return { return {
name: 'Bada', name: 'Bada',
@ -126,7 +122,7 @@ export default [
{ {
test: [/tizen/i], test: [/tizen/i],
describe(ua) { describe(ua) {
const version = getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i, ua); const version = Utils.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i, ua);
return { return {
name: 'Tizen', name: 'Tizen',

View File

@ -1,4 +1,4 @@
import { getFirstMatch } from './utils'; import Utils from './utils.js';
const TYPES_LABELS = { const TYPES_LABELS = {
tablet: 'tablet', tablet: 'tablet',
@ -27,7 +27,7 @@ export default [
{ {
test: [/huawei/i], test: [/huawei/i],
describe(ua) { describe(ua) {
const model = getFirstMatch(/(can-l01)/i, ua) && 'Nova'; const model = Utils.getFirstMatch(/(can-l01)/i, ua) && 'Nova';
const platform = { const platform = {
type: TYPES_LABELS.mobile, type: TYPES_LABELS.mobile,
vendor: 'Huawei', vendor: 'Huawei',
@ -103,7 +103,7 @@ export default [
return iDevice && !likeIDevice; return iDevice && !likeIDevice;
}, },
describe(ua) { describe(ua) {
const model = getFirstMatch(/(ipod|iphone)/i, ua); const model = Utils.getFirstMatch(/(ipod|iphone)/i, ua);
return { return {
type: TYPES_LABELS.mobile, type: TYPES_LABELS.mobile,
vendor: 'Apple', vendor: 'Apple',

View File

@ -1,8 +1,8 @@
import browserParsersList from './parser-browsers'; import browserParsersList from './parser-browsers.js';
import osParsersList from './parser-os'; import osParsersList from './parser-os.js';
import platformParsersList from './parser-platforms'; import platformParsersList from './parser-platforms.js';
import enginesParsersList from './parser-engines'; import enginesParsersList from './parser-engines.js';
import { compareVersions } from './utils'; import Utils from './utils.js';
/** /**
* The main class that arranges the whole parsing process. * The main class that arranges the whole parsing process.
@ -438,7 +438,7 @@ class Parser {
} }
return expectedResults.indexOf( return expectedResults.indexOf(
compareVersions(currentBrowserVersion, comparableVersion, isLoose), Utils.compareVersions(currentBrowserVersion, comparableVersion, isLoose),
) > -1; ) > -1;
} }

View File

@ -1,4 +1,4 @@
class Utils { export default class Utils {
/** /**
* Get first matched item for a string * Get first matched item for a string
* @param {RegExp} regexp * @param {RegExp} regexp
@ -188,5 +188,3 @@ class Utils {
return result; return result;
} }
} }
module.exports = Utils;