1
0
mirror of https://github.com/lancedikson/bowser synced 2026-03-02 03:40:27 +00:00

Document User-Agent Client Hints feature in README and source code

Co-authored-by: naorpeled <6171622+naorpeled@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-06 21:16:21 +00:00
parent 45296b224e
commit 3c5236ca16
9 changed files with 1723 additions and 91 deletions

View File

@@ -83,6 +83,11 @@ class Parser {
* @return {ClientHints|null}
*
* @public
* @example
* const parser = Bowser.getParser(UA, clientHints);
* const hints = parser.getHints();
* console.log(hints.platform); // 'Windows'
* console.log(hints.mobile); // false
*/
getHints() {
return this._hints;
@@ -94,6 +99,11 @@ class Parser {
* @return {boolean}
*
* @public
* @example
* const parser = Bowser.getParser(UA, clientHints);
* if (parser.hasBrand('Google Chrome')) {
* console.log('Chrome detected!');
* }
*/
hasBrand(brandName) {
if (!this._hints || !Array.isArray(this._hints.brands)) {
@@ -111,6 +121,10 @@ class Parser {
* @return {string|undefined}
*
* @public
* @example
* const parser = Bowser.getParser(UA, clientHints);
* const version = parser.getBrandVersion('Google Chrome');
* console.log(version); // '131'
*/
getBrandVersion(brandName) {
if (!this._hints || !Array.isArray(this._hints.brands)) {