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

Merge branch '2.4.0' into production

This commit is contained in:
Denis Demchenko 2019-05-03 21:51:38 +03:00
commit 5a6dcc2899
15 changed files with 587 additions and 2056 deletions

View File

@ -7,6 +7,7 @@ rules:
- 'error'
- 'ignorePackages'
- {js: 'always'}
import/prefer-default-export: 1
plugins:
- ava

View File

@ -1,5 +1,11 @@
# Bowser Changelog
### 2.4.0 (May 3, 2019)
- [FIX] Update regexp for generic browsers (#310)
- [FIX] Fix issues with module.exports (#318)
- [FIX] Update devDependencies (#316, #321, #322)
- [FIX] Fix docs (#320)
### 2.3.0 (April 14, 2019)
- [ADD] Add support for Blink-based MS Edge (#311)
- [ADD] Add more types for TS (#289)

View File

@ -572,7 +572,7 @@ const result = parser.getResult();</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Apr 14 2019 13:45:42 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri May 03 2019 21:50:23 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>

View File

@ -2566,7 +2566,7 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
<h5>Example</h5>
<pre class="prettyprint"><code>const browser = new Bowser(UA);
<pre class="prettyprint"><code>const browser = Bowser.getParser(window.navigator.userAgent);
if (browser.satisfies({chrome: '>118.01.1322' }))
// or with os
if (browser.satisfies({windows: { chrome: '>118.01.1322' } }))
@ -2989,7 +2989,7 @@ Returns <code>undefined</code> when the browser is no described in the checkTree
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Apr 14 2019 13:45:42 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri May 03 2019 21:50:23 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>

View File

@ -105,7 +105,7 @@ export default Bowser;
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Apr 14 2019 13:45:42 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri May 03 2019 21:50:23 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>

View File

@ -1995,7 +1995,7 @@ like <code>&quot;iPhone&quot;</code> or <code>&quot;Kindle Fire HD 7&quot;</code
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Apr 14 2019 13:45:42 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri May 03 2019 21:50:23 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>

View File

@ -157,7 +157,7 @@ list of aliases can be found in <a href="src/constants.js">the file</a>.</p>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Apr 14 2019 13:45:42 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri May 03 2019 21:50:23 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>

View File

@ -385,7 +385,7 @@ class Parser {
* Returns `undefined` when the browser is no described in the checkTree object.
*
* @example
* const browser = new Bowser(UA);
* const browser = Bowser.getParser(window.navigator.userAgent);
* if (browser.satisfies({chrome: '>118.01.1322' }))
* // or with os
* if (browser.satisfies({windows: { chrome: '>118.01.1322' } }))
@ -546,7 +546,7 @@ export default Parser;
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Apr 14 2019 13:45:42 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri May 03 2019 21:50:23 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>

View File

@ -260,7 +260,7 @@ export default class Utils {
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Apr 14 2019 13:45:42 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri May 03 2019 21:50:23 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>

2577
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "bowser",
"version": "2.3.0",
"version": "2.4.0",
"description": "Lightweight browser detector",
"keywords": [
"browser",
@ -34,17 +34,17 @@
"ava": "^1.4.1",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.5",
"babel-plugin-add-module-exports": "^1.0.0",
"babel-plugin-add-module-exports": "^1.0.2",
"babel-plugin-istanbul": "^5.1.1",
"coveralls": "^3.0.2",
"docdash": "^1.0.0",
"eslint": "^5.16.0",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-plugin-ava": "^6.0.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-import": "^2.17.2",
"gh-pages": "^2.0.1",
"jsdoc": "^3.5.5",
"nyc": "^13.3.0",
"nyc": "^14.0.0",
"sinon": "^7.2.4",
"testem": "^2.15.1",
"webpack": "^4.28.4",

View File

@ -1,6 +1,6 @@
// NOTE: this list must be up-to-date with browsers listed in
// test/acceptance/useragentstrings.yml
const BROWSER_ALIASES_MAP = {
export const BROWSER_ALIASES_MAP = {
'Amazon Silk': 'amazon_silk',
'Android Browser': 'android',
Bada: 'bada',
@ -36,7 +36,3 @@ const BROWSER_ALIASES_MAP = {
WeChat: 'wechat',
'Yandex Browser': 'yandex',
};
module.exports = {
BROWSER_ALIASES_MAP,
};

View File

@ -606,9 +606,17 @@ const browsersList = [
{
test: [/.*/i],
describe(ua) {
/* Here we try to make sure that there are explicit details about the device
* in order to decide what regexp exactly we want to apply
* (as there is a specific decision based on that conclusion)
*/
const regexpWithoutDeviceSpec = /^(.*)\/(.*) /;
const regexpWithDeviceSpec = /^(.*)\/(.*)[ \t]\((.*)/;
const hasDeviceSpec = ua.search('\\(') !== -1;
const regexp = hasDeviceSpec ? regexpWithDeviceSpec : regexpWithoutDeviceSpec;
return {
name: Utils.getFirstMatch(/^(.*)\/(.*) /, ua),
version: Utils.getSecondMatch(/^(.*)\/(.*) /, ua),
name: Utils.getFirstMatch(regexp, ua),
version: Utils.getSecondMatch(regexp, ua),
};
},
},

View File

@ -342,7 +342,7 @@ class Parser {
* Returns `undefined` when the browser is no described in the checkTree object.
*
* @example
* const browser = new Bowser(UA);
* const browser = Bowser.getParser(window.navigator.userAgent);
* if (browser.satisfies({chrome: '>118.01.1322' }))
* // or with os
* if (browser.satisfies({windows: { chrome: '>118.01.1322' } }))

View File

@ -2269,6 +2269,19 @@
os: {}
platform: {}
engine: {}
-
ua: "Generic/2.15 (Macintosh; Intel Mac OS X 10_6_8)"
spec:
browser:
name: "Generic"
version: "2.15"
os:
name: "macOS"
version: "10.6.8"
platform:
type: "desktop"
vendor: "Apple"
engine: {}
Googlebot:
-
ua: "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"