You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The project runs Git-flow, where the `master` branch is the development one and `production` is the production one.
3
+
We're always open to pull requests or code reviews. Everyone can become a permanent contributor. Just ping @lancedikson in the issues or on Twitter ❤️
4
4
5
-
In a nutshell, if you're about to propose a new feature with adding some totally new functionality to `bowser`, it's better to branch from `master` and make a PR pointing back to `master` as well.
6
-
If it's a small hotfix, fix a typo in the docs or you've added support for a new browser/OS/platform/etc, then it's better to branch from `production` and make a PR pointing back to `production`.
7
-
Following these simple rules will help to maintain the repo a lot! Thanks ❤️
5
+
## Branches
6
+
7
+
The project runs Git-flow, where the `master` branch is for development and `production` is for production.
8
+
9
+
In a nutshell, if you are proposing a new feature that adds totally new functionality to `bowser`, it's better to branch from `master` and make a PR pointing back to `master` as well.
10
+
11
+
If it's a small hot-fix, an improvement to the docs, or added support for a new browser/OS/platform/etc, then it's better to branch from `production` and make a PR pointing back to `production`.
12
+
13
+
Following these simple rules will really help maintain the repo! Thanks ❤️
14
+
15
+
## Adding Tests
16
+
17
+
See the list in `test/acceptance/useragentstrings.yml` with example user agents and their expected `bowser` object.
18
+
19
+
Whenever you add support for new browsers or notice a bug / mismatch, please update the list and
20
+
check if all tests are still passing.
21
+
22
+
## Testing
23
+
24
+
If you'd like to contribute a change to `bowser`, modify the files in `src/`, and run the following (you'll need `node` + `npm` installed):
Copy file name to clipboardExpand all lines: README.md
+13-28Lines changed: 13 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,19 +13,23 @@ A browser detector. Because sometimes, there is no other way, and not even good
13
13
14
14
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.
15
15
16
-
_Please, note that this is an alpha version. Check out the [1.x](https://github.com/lancedikson/bowser/tree/v1.x) branch for a stable version._
17
-
18
16
**Changes of version 2.0**
19
-
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.
17
+
18
+
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.
19
+
20
+
_For legacy code, check out the [1.x](https://github.com/lancedikson/bowser/tree/v1.x) branch and install it through `npm install [email protected]`._
21
+
20
22
21
23
# Use cases
22
24
23
-
First of all, require the library. This is a UMD Module, so it will work for AMD, Typescript and CommonJS module systems.
25
+
First of all, require the library. This is a UMD Module, so it will work for AMD, TypeScript, ES6, and CommonJS module systems.
24
26
25
27
```javascript
26
28
constBowser=require("bowser"); // CommonJS
27
29
28
-
import*asBowserfrom"bowser"// Typescript
30
+
import*asBowserfrom"bowser"; // TypeScript
31
+
32
+
importBowserfrom"bowser"; // ES6 (and TypeScript with --esModuleInterop enabled)
29
33
```
30
34
31
35
By default, the exported version is the *ES5 transpiled version*, which **do not** include any polyfills.
@@ -41,7 +45,7 @@ You may need to use the source files, so they will be available in the package a
41
45
Often we need to pick users' browser properties such as the name, the version, the rendering engine and so on. Here is an example how to do it with Bowser:
0 commit comments