diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 3ec50a0..b8b8326 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,6 +1,6 @@ # These are supported funding model platforms -github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +github: faisalman patreon: # Replace with a single Patreon username open_collective: ua-parser-js ko_fi: # Replace with a single Ko-fi username diff --git a/license.md b/license.md index 01d840a..9ba50e2 100644 --- a/license.md +++ b/license.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2012-2021 Faisal Salman <> +Copyright (c) 2012-2023 Faisal Salman <> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/package.json b/package.json index 7d98775..37854dc 100644 --- a/package.json +++ b/package.json @@ -197,6 +197,10 @@ { "type": "paypal", "url": "https://paypal.me/faisalman" + }, + { + "type": "github", + "url": "https://github.com/sponsors/faisalman" } ] } diff --git a/readme.md b/readme.md index fd32a7f..acf44a1 100644 --- a/readme.md +++ b/readme.md @@ -90,10 +90,10 @@ The methods are self explanatory, here's a small overview on all the available m --- -* `getResult() : UAResult` +* `getResult()` * returns `{ ua: '', browser: UABrowser {}, cpu: UACPU {}, device: UADevice {}, engine: UAEngine {}, os: UAOS {} }` -* `getBrowser() : UABrowser` +* `getBrowser()` * returns `{ name: '', version: '' }` ```sh @@ -117,7 +117,7 @@ Vivaldi, Waterfox, WeChat, Weibo, Yandex, baidu, iCab, w3m, Whale Browser... # 'browser.version' determined dynamically ``` -* `getDevice() : UADevice` +* `getDevice()` * returns `{ model: '', type: '', vendor: '' }` ```sh @@ -141,7 +141,7 @@ Siemens, Sony[Ericsson], Sprint, Tesla, Vivo, Vodafone, Xbox, Xiaomi, Zebra, ZTE # 'device.model' determined dynamically ``` -* `getEngine() : UAEngine` +* `getEngine()` * returns `{ name: '', version: '' }` ```sh @@ -152,7 +152,7 @@ NetSurf, Presto, Tasman, Trident, w3m, WebKit # 'engine.version' determined dynamically ``` -* `getOS() : UAOS` +* `getOS()` * returns `{ name: '', version: '' }` ```sh @@ -169,7 +169,7 @@ Ubuntu, Unix, VectorLinux, Viera, watchOS, WebOS, Windows [Phone/Mobile], Zenwal # 'os.version' determined dynamically ``` -* `getCPU() : UACPU` +* `getCPU()` * returns `{ architecture: '' }` ```sh @@ -177,7 +177,7 @@ Ubuntu, Unix, VectorLinux, Viera, watchOS, WebOS, Windows [Phone/Mobile], Zenwal 68k, amd64, arm[64/hf], avr, ia[32/64], irix[64], mips[64], pa-risc, ppc, sparc[64] ``` -* `getUA() : string` +* `getUA()` * returns UA string of current instance * `setUA(uastring)` @@ -479,7 +479,7 @@ Made with [contributors-img](https://contrib.rocks). MIT License -Copyright (c) 2012-2021 Faisal Salman <> +Copyright (c) 2012-2023 Faisal Salman <> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/ua-parser.js b/src/ua-parser.js index 188fbcb..a219a38 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////////// /* UAParser.js v1.1.34 - Copyright © 2012-2021 Faisal Salman + Copyright © 2012-2023 Faisal Salman MIT License *//* Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data. Supports browser & node.js environment. @@ -802,8 +802,7 @@ UAItem.prototype.then = function (callback) { return callback(this.data); }; - - var createUAData = function (data) { + UAItem.createUAData = function (data) { return (function () { var propIs = data.propIs; var ignoreIs = data.ignoreIs; @@ -840,7 +839,7 @@ }; function UABrowser () { - this.data = createUAData({ + this.data = UAItem.createUAData({ props : [NAME, VERSION, MAJOR], propIs : [NAME], ignoreIs : ' ?browser$', @@ -850,7 +849,7 @@ UABrowser.prototype = new UAItem(); function UACPU () { - this.data = createUAData({ + this.data = UAItem.createUAData({ props : [ARCHITECTURE], propIs : [ARCHITECTURE], propToStr : [ARCHITECTURE] @@ -859,7 +858,7 @@ UACPU.prototype = new UAItem(); function UADevice () { - this.data = createUAData({ + this.data = UAItem.createUAData({ props : [TYPE, MODEL, VENDOR], propIs : [TYPE, MODEL, VENDOR], propToStr : [VENDOR, MODEL] @@ -868,7 +867,7 @@ UADevice.prototype = new UAItem(); function UAEngine () { - this.data = createUAData({ + this.data = UAItem.createUAData({ props : [NAME, VERSION], propIs : [NAME], propToStr : [NAME, VERSION] @@ -877,7 +876,7 @@ UAEngine.prototype = new UAItem(); function UAOS () { - this.data = createUAData({ + this.data = UAItem.createUAData({ props : [NAME, VERSION], propIs : [NAME], ignoreIs : ' ?os$', diff --git a/test/test.js b/test/test.js index a906e2c..7b4e4a4 100644 --- a/test/test.js +++ b/test/test.js @@ -228,7 +228,7 @@ describe('is() utility method', function () { uap.setUA(""); assert.strictEqual(uap.getDevice().model, undefined); - assert.strictEqual(uap.getDevice().is("undefined"), true); + assert.strictEqual(uap.getDevice().is("undefined"), false); assert.strictEqual(uap.getDevice().is(undefined), true); });