diff --git a/README.md b/README.md index 9e29590..0e04590 100644 --- a/README.md +++ b/README.md @@ -105,15 +105,15 @@ const isValidBrowser = browser.satisfies({ // per platform (mobile, desktop or tablet) mobile: { - safari: '>9', + safari: '>=9', 'android browser': '>3.10' }, // or in general - chrome: ">20.1.1432", + chrome: "~20.1.1432", firefox: ">31", - opera: ">22" - + opera: ">=22" + // also supports equality operator chrome: "=20.1.1432", // will match particular build only diff --git a/docs/Bowser.html b/docs/Bowser.html index d1122b1..601880c 100644 --- a/docs/Bowser.html +++ b/docs/Bowser.html @@ -572,7 +572,7 @@ const result = parser.getResult();
diff --git a/docs/Parser.html b/docs/Parser.html index 7b1cfe6..a82d141 100644 --- a/docs/Parser.html +++ b/docs/Parser.html @@ -1564,7 +1564,7 @@ like Parser#parseBrowser or Source:
@@ -2211,7 +2211,7 @@ the OS called "anything" or the platform called "anything"Source:
@@ -2382,7 +2382,7 @@ Returns undefined when the browser is no described in the checkTree
Source:
@@ -2422,7 +2422,7 @@ Returns undefined when the browser is no described in the checkTree
-

Check if any of the given values satifies this.is(anything)

+

Check if any of the given values satisfies this.is(anything)

@@ -2687,7 +2687,7 @@ Returns undefined when the browser is no described in the checkTree
diff --git a/docs/bowser.js.html b/docs/bowser.js.html index 862d041..36c757e 100644 --- a/docs/bowser.js.html +++ b/docs/bowser.js.html @@ -105,7 +105,7 @@ export default Bowser;
diff --git a/docs/global.html b/docs/global.html index 4310d63..98d163a 100644 --- a/docs/global.html +++ b/docs/global.html @@ -766,7 +766,7 @@ like "iPhone" or "Kindle Fire HD 7" diff --git a/docs/index.html b/docs/index.html index 066ec44..0ec5acb 100644 --- a/docs/index.html +++ b/docs/index.html @@ -62,9 +62,10 @@

Please, note that this is an alpha version. Check out the 1.x branch for a stable version.

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

-

Use cases

First of all, require the library:

-
const bowser = require('bowser');

By default, require('bowser') requires the ES5 version of files, which -do not include any polyfills.

+

Use cases

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

+
const Bowser = require("bowser"); // CommonJS
+
+import * as Bowser from "bowser" // Typescript

By default, the exported version is the ES5 transpiled version, which do not include any polyfills.

In case you don't use your own babel-polyfill you may need to have pre-built bundle with all needed polyfills. So, for you it's suitable to require bowser like this: require('bowser/bundled'). As the result, you get a ES5 version of bowser with babel-polyfill bundled together.

@@ -83,6 +84,7 @@ impression.brVer = browserInfo.version;

or

const browser = bowser.getParser(window.navigator.userAgent);
 impression.userTechData = browser.parse();
 console.log(impression.userTechData);
+
 // outputs
 {
   browser: {
@@ -115,14 +117,14 @@ const isValidBrowser = browser.satisfies({
 
   // per platform (mobile, desktop or tablet)
   mobile: {
-    safari: '>9',
+    safari: '>=9',
     'android browser': '>3.10'
   },
 
   // or in general
-  chrome: ">20.1.1432",
+  chrome: "~20.1.1432",
   firefox: ">31",
-  opera: ">22"
+  opera: ">=22"
 
   // also supports equality operator
   chrome: "=20.1.1432", // will match particular build only
@@ -134,8 +136,9 @@ const isValidBrowser = browser.satisfies({
 Thus, you can define OS or platform specific rules and they will have more priority in the end.

More of API and possibilities you will find in the docs folder.

Contributing

If you'd like to contribute a change to bowser, modify the files in src/, then run the following (you'll need node + npm installed):

-
$ npm install
-$ npm test

Adding tests

See the list in test/acceptance/useragentstrings.yml with example user agents and their expected bowser object.

+
$ npm install #build
+$ npm test #run tests
+$ npm run lint #check lint rules

Adding tests

See the list in test/acceptance/useragentstrings.yml with example user agents and their expected bowser object.

Whenever you add support for new browsers or notice a bug / mismatch, please update the list and check if all tests are still passing.

Similar Projects