mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
Merge branch 'release/2.0.0-alpha.4'
This commit is contained in:
commit
2c5ab93a19
@ -1,5 +1,9 @@
|
||||
# Bowser Changelog
|
||||
|
||||
### 2.0.0-alpha.4 (August 2, 2018)
|
||||
- [DOCS] Fix usage docs (#238)
|
||||
- [CHANGE] Make `./es5.js` the main file of the package (#239)
|
||||
|
||||
### 2.0.0-alpha.3 (July 22, 2018)
|
||||
- [CHANGE] Rename split and rename `compiled.js` to `es5.js` and `bundled.js` (#231, #236, #237)
|
||||
- [ADD] Add `Parser.some` (#235)
|
||||
|
@ -26,15 +26,14 @@ First of all, require the library:
|
||||
const bowser = require('bowser');
|
||||
```
|
||||
|
||||
By default, `require('bowser')` requires the *ES6 version of files*, which
|
||||
By default, `require('bowser')` requires the *ES5 version of files*, which
|
||||
**do not** include any polyfills.
|
||||
|
||||
In case if 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.
|
||||
|
||||
If you use bowser for Node.js, you'd better use `require('bowser/es5')`,
|
||||
since source files have `import` statements, which are not compatible with Node.js yet.
|
||||
You may need to use the source files, so they will be available in the package as well.
|
||||
|
||||
## Browser props detection
|
||||
|
||||
@ -92,7 +91,7 @@ You could want to filter some particular browsers to provide any special support
|
||||
It could look like this:
|
||||
|
||||
```javascript
|
||||
const browser = bowser.getParsers(window.navigator.userAgent);
|
||||
const browser = bowser.getParser(window.navigator.userAgent);
|
||||
const isValidBrowser = browser.satisfies({
|
||||
// declare browsers per OS
|
||||
windows: {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "bowser",
|
||||
"version": "2.0.0-alpha.3",
|
||||
"version": "2.0.0-alpha.4",
|
||||
"description": "Lightweight browser detector",
|
||||
"keywords": [
|
||||
"browser",
|
||||
@ -20,7 +20,7 @@
|
||||
"url": "http://twitter.com/lancedikson"
|
||||
}
|
||||
],
|
||||
"main": "src/bowser.js",
|
||||
"main": "es5.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lancedikson/bowser.git"
|
||||
|
@ -26,7 +26,7 @@ class Bowser {
|
||||
* const bowser = new Bowser(window.navigator.userAgent);
|
||||
* bowser.getResult()
|
||||
*/
|
||||
static getParser(UA, skipParsing=false) {
|
||||
static getParser(UA, skipParsing = false) {
|
||||
if (typeof UA !== 'string') {
|
||||
throw new Error('UserAgent should be a string');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user