diff options
author | Minteck <contact@minteck.org> | 2022-08-10 10:38:44 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-08-10 10:38:44 +0200 |
commit | c6dbf0450566c40efc4a26f4f0717452b6ef95cd (patch) | |
tree | b4be2d508223820d0a77d5a3e35e82684da3b6ec /node_modules/ua-parser/js/lib/results.js | |
download | hornchat-c6dbf0450566c40efc4a26f4f0717452b6ef95cd.tar.gz hornchat-c6dbf0450566c40efc4a26f4f0717452b6ef95cd.tar.bz2 hornchat-c6dbf0450566c40efc4a26f4f0717452b6ef95cd.zip |
Diffstat (limited to 'node_modules/ua-parser/js/lib/results.js')
-rw-r--r-- | node_modules/ua-parser/js/lib/results.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/node_modules/ua-parser/js/lib/results.js b/node_modules/ua-parser/js/lib/results.js new file mode 100644 index 0000000..0b30cd0 --- /dev/null +++ b/node_modules/ua-parser/js/lib/results.js @@ -0,0 +1,47 @@ +var UNDEF = void 0; + +exports.BackwardsCompatResults = BackwardsCompatResults; +function BackwardsCompatResults(ua_str, ua, os, device) { + this.string = ua_str; + this.userAgent = this.ua = ua; + this.os = os; + this.device = device + + // Backwards compat + var major = ua.major, + minor = ua.minor, + patch = ua.patch; + + this.family = ua.family; + this.major = major === null ? UNDEF : parseInt(major); + this.minor = minor === null ? UNDEF : parseInt(minor); + this.patch = patch === null ? UNDEF : parseInt(patch); +} + +// Backwards compat +BackwardsCompatResults.prototype.toVersionString = function() { + var output = '', + ua = this.ua; + if (ua.major != null) { + output += ua.major; + if (ua.minor != null) { + output += '.' + ua.minor; + if (ua.patch != null) { + output += '.' + ua.patch; + } + } + } + return output; +}; + +// Backwards compat +BackwardsCompatResults.prototype.toString = function() { + var suffix = this.toVersionString(); + if (suffix) { suffix = ' ' + suffix; } + return this.ua.family + suffix; +}; + +// Backwards compat +BackwardsCompatResults.prototype.toFullString = function() { + return this.toString() + (this.os ? '/' + this.os : ''); +}; |