summaryrefslogtreecommitdiff
path: root/node_modules/ua-parser/js/lib/results.js
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-08-10 10:38:44 +0200
committerMinteck <contact@minteck.org>2022-08-10 10:38:44 +0200
commitc6dbf0450566c40efc4a26f4f0717452b6ef95cd (patch)
treeb4be2d508223820d0a77d5a3e35e82684da3b6ec /node_modules/ua-parser/js/lib/results.js
downloadhornchat-c6dbf0450566c40efc4a26f4f0717452b6ef95cd.tar.gz
hornchat-c6dbf0450566c40efc4a26f4f0717452b6ef95cd.tar.bz2
hornchat-c6dbf0450566c40efc4a26f4f0717452b6ef95cd.zip
Initial commitHEADmane
Diffstat (limited to 'node_modules/ua-parser/js/lib/results.js')
-rw-r--r--node_modules/ua-parser/js/lib/results.js47
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 : '');
+};