From bf69678f8607fd9727f2f32e1754c87ac3e96879 Mon Sep 17 00:00:00 2001 From: Denis Demchenko Date: Wed, 6 Mar 2019 14:30:40 +0200 Subject: [PATCH 1/2] Bump version, write chagelog --- CHANGELOG.md | 6 ++++++ package-lock.json | 2 +- package.json | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2317396..14d1e1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Bowser Changelog +### 2.1.1 (January 24, 2019) +- [ADD] Add detection of PlayStation 4 (#291) +- [ADD] Deploy docs on GH Pages (#293) +- [FIX] Fix files extensions for importing (#294) +- [FIX] Fix docs (#295) + ### 2.1.0 (January 24, 2019) - [ADD] Add new `Parser.getEngineName()` method (#288) - [ADD] Add detection of ChromeOS (#287) diff --git a/package-lock.json b/package-lock.json index ddbdc69..9666b13 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "bowser", - "version": "2.1.0", + "version": "2.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index a06e922..52d634f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bowser", - "version": "2.1.0", + "version": "2.1.1", "description": "Lightweight browser detector", "keywords": [ "browser", From 58a871b5da798760fd658a8719f91c6473cbeb51 Mon Sep 17 00:00:00 2001 From: Denis Demchenko Date: Wed, 6 Mar 2019 14:31:37 +0200 Subject: [PATCH 2/2] Update docs --- docs/Bowser.html | 4 +- docs/Parser.html | 4 +- docs/bowser.js.html | 6 +- docs/global.html | 1077 ++++++++++++++++++++++++++++++++++++++++++- docs/index.html | 23 +- docs/parser.js.html | 16 +- docs/utils.js.html | 8 +- 7 files changed, 1104 insertions(+), 34 deletions(-) diff --git a/docs/Bowser.html b/docs/Bowser.html index 21c58c5..8971ea5 100644 --- a/docs/Bowser.html +++ b/docs/Bowser.html @@ -26,7 +26,7 @@
@@ -572,7 +572,7 @@ const result = parser.getResult();
- Documentation generated by JSDoc 3.5.5 on Wed Feb 13 2019 19:42:10 GMT-0800 (Pacific Standard Time) using the docdash theme. + Documentation generated by JSDoc 3.5.5 on Wed Mar 06 2019 14:31:23 GMT+0200 (EET) using the docdash theme.
diff --git a/docs/Parser.html b/docs/Parser.html index 5921b4b..cae36d6 100644 --- a/docs/Parser.html +++ b/docs/Parser.html @@ -26,7 +26,7 @@
@@ -2793,7 +2793,7 @@ Returns undefined when the browser is no described in the checkTree
- Documentation generated by JSDoc 3.5.5 on Wed Feb 13 2019 19:42:10 GMT-0800 (Pacific Standard Time) using the docdash theme. + Documentation generated by JSDoc 3.5.5 on Wed Mar 06 2019 14:31:23 GMT+0200 (EET) using the docdash theme.
diff --git a/docs/bowser.js.html b/docs/bowser.js.html index b3a4f3f..a3c551b 100644 --- a/docs/bowser.js.html +++ b/docs/bowser.js.html @@ -26,7 +26,7 @@
@@ -47,7 +47,7 @@ * MIT License | (c) Dustin Diaz 2012-2015 * MIT License | (c) Denis Demchenko 2015-2017 */ -import Parser from './parser'; +import Parser from './parser.js'; /** * Bowser class. @@ -105,7 +105,7 @@ export default Bowser;
- Documentation generated by JSDoc 3.5.5 on Wed Feb 13 2019 19:42:10 GMT-0800 (Pacific Standard Time) using the docdash theme. + Documentation generated by JSDoc 3.5.5 on Wed Mar 06 2019 14:31:23 GMT+0200 (EET) using the docdash theme.
diff --git a/docs/global.html b/docs/global.html index 8a2650f..6b7e103 100644 --- a/docs/global.html +++ b/docs/global.html @@ -26,7 +26,7 @@
@@ -114,6 +114,1079 @@ +

Methods

+ + + + + + +

getAndroidVersionName(version) → {string}

+ + + + + + +
+ + +
Source:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Get Android version name + 1.5 - Cupcake + 1.6 - Donut + 2.0 - Eclair + 2.1 - Eclair + 2.2 - Froyo + 2.x - Gingerbread + 3.x - Honeycomb + 4.0 - Ice Cream Sandwich + 4.1 - Jelly Bean + 4.4 - KitKat + 5.x - Lollipop + 6.x - Marshmallow + 7.x - Nougat + 8.x - Oreo + 9.x - ?

+
+ + + + + + + + + +
Example
+ +
getAndroidVersionName("7.0") // 'Nougat'
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
version + + +string + + + +
+ + + + + + + + + + + + + + +
Returns:
+ + +
+

versionName

+
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + +

getFirstMatch(regexp, ua) → {Array|Object|*|boolean|string}

+ + + + + + +
+ + +
Source:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Get first matched item for a string

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
regexp + + +RegExp + + + +
ua + + +String + + + +
+ + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Array +| + +Object +| + +* +| + +boolean +| + +string + + +
+
+ + + + + + + + + +

getSecondMatch(regexp, ua) → {Array|Object|*|boolean|string}

+ + + + + + +
+ + +
Source:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Get second matched item for a string

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
regexp + +
ua + + +String + + + +
+ + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Array +| + +Object +| + +* +| + +boolean +| + +string + + +
+
+ + + + + + + + + +

getVersionPrecision(version) → {number}

+ + + + + + +
+ + +
Source:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Get version precisions count

+
+ + + + + + + + + +
Example
+ +
getVersionPrecision("1.10.3") // 3
+ + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
version + + +string + + + +
+ + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +number + + +
+
+ + + + + + + + + +

map(arr, iterator) → {Array}

+ + + + + + +
+ + +
Source:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Array::map polyfill

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
arr + + +Array + + + +
iterator + + +function + + + +
+ + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Array + + +
+
+ + + + + + + + + +

matchAndReturnConst(regexp, ua, _const) → {*}

+ + + + + + +
+ + +
Source:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Match a regexp and return a constant or undefined

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
regexp + + +RegExp + + + +
ua + + +String + + + +
_const + + +* + + + +

Any const that will be returned if regexp matches the string

+ + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +* + + +
+
+ + + + + +

Type Definitions

@@ -766,7 +1839,7 @@ like "iPhone" or "Kindle Fire HD 7"
- Documentation generated by JSDoc 3.5.5 on Wed Feb 13 2019 19:42:10 GMT-0800 (Pacific Standard Time) using the docdash theme. + Documentation generated by JSDoc 3.5.5 on Wed Mar 06 2019 14:31:23 GMT+0200 (EET) using the docdash theme.
diff --git a/docs/index.html b/docs/index.html index cf1673b..6a8be54 100644 --- a/docs/index.html +++ b/docs/index.html @@ -26,7 +26,7 @@
@@ -59,8 +59,7 @@
  • How can I help?
  • Overview

    The library is made to help to detect what browser your user has and gives you a convenient API to filter the users somehow depending on their browsers.

    -

    Changes of version 2.0

    -

    The version 2.0 has drastically changed API. All available methods can be found in the docs folder from now on and on a webpage soon.

    +

    ⚠️ Version 2.0 breaking changes ⚠️

    Version 2.0 has drastically changed the API. All available methods are on the docs page.

    For legacy code, check out the 1.x branch and install it through npm install bowser@1.9.4.

    Use cases

    First of all, require the library. This is a UMD Module, so it will work for AMD, TypeScript, ES6, and CommonJS module systems.

    const Bowser = require("bowser"); // CommonJS
    @@ -77,15 +76,15 @@ As the result, you get a ES5 version of bowser with babel-polyfill
     
     console.log(`The current browser name is "${browser.getBrowserName()}"`);
     // The current browser name is "Internet Explorer"

    or

    -
    const impression = new Impression();
    -
    -const browser = Bowser.getParser(window.navigator.userAgent);
    -const browserInfo = browser.getBrowser();
    -impression.brName = browserInfo.name;
    -impression.brVer = browserInfo.version;

    or

    const browser = Bowser.getParser(window.navigator.userAgent);
    -impression.userTechData = browser.parse();
    -console.log(impression.userTechData);
    +console.log(browser.getBrowser());
    +
    +// outputs
    +{
    +  name: "Internet Explorer"
    +  version: "11.0"
    +}

    or

    +
    console.log(Bowser.parse(window.navigator.userAgent));
     
     // outputs
     {
    @@ -155,7 +154,7 @@ Thus, you can define OS or platform specific rules and they will have more prior
     
    - Documentation generated by JSDoc 3.5.5 on Wed Feb 13 2019 19:42:10 GMT-0800 (Pacific Standard Time) using the docdash theme. + Documentation generated by JSDoc 3.5.5 on Wed Mar 06 2019 14:31:23 GMT+0200 (EET) using the docdash theme.
    diff --git a/docs/parser.js.html b/docs/parser.js.html index 793aa17..ef5bcc6 100644 --- a/docs/parser.js.html +++ b/docs/parser.js.html @@ -26,7 +26,7 @@
    @@ -41,11 +41,11 @@
    -
    import browserParsersList from './parser-browsers';
    -import osParsersList from './parser-os';
    -import platformParsersList from './parser-platforms';
    -import enginesParsersList from './parser-engines';
    -import { compareVersions } from './utils';
    +            
    import browserParsersList from './parser-browsers.js';
    +import osParsersList from './parser-os.js';
    +import platformParsersList from './parser-platforms.js';
    +import enginesParsersList from './parser-engines.js';
    +import Utils from './utils.js';
     
     /**
      * The main class that arranges the whole parsing process.
    @@ -481,7 +481,7 @@ class Parser {
         }
     
         return expectedResults.indexOf(
    -      compareVersions(currentBrowserVersion, comparableVersion, isLoose),
    +      Utils.compareVersions(currentBrowserVersion, comparableVersion, isLoose),
         ) > -1;
       }
     
    @@ -532,7 +532,7 @@ export default Parser;
     
    - Documentation generated by JSDoc 3.5.5 on Wed Feb 13 2019 19:42:10 GMT-0800 (Pacific Standard Time) using the docdash theme. + Documentation generated by JSDoc 3.5.5 on Wed Mar 06 2019 14:31:23 GMT+0200 (EET) using the docdash theme.
    diff --git a/docs/utils.js.html b/docs/utils.js.html index 425f4fd..4e1bdcb 100644 --- a/docs/utils.js.html +++ b/docs/utils.js.html @@ -26,7 +26,7 @@
    @@ -41,7 +41,7 @@
    -
    class Utils {
    +            
    export default class Utils {
       /**
        * Get first matched item for a string
        * @param {RegExp} regexp
    @@ -231,8 +231,6 @@
         return result;
       }
     }
    -
    -module.exports = Utils;
     
    @@ -247,7 +245,7 @@ module.exports = Utils;
    - Documentation generated by JSDoc 3.5.5 on Wed Feb 13 2019 19:42:10 GMT-0800 (Pacific Standard Time) using the docdash theme. + Documentation generated by JSDoc 3.5.5 on Wed Mar 06 2019 14:31:23 GMT+0200 (EET) using the docdash theme.