From c6dbf0450566c40efc4a26f4f0717452b6ef95cd Mon Sep 17 00:00:00 2001 From: Minteck Date: Wed, 10 Aug 2022 10:38:44 +0200 Subject: Initial commit --- node_modules/ua-parser/js/lib/results.js | 47 ++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 node_modules/ua-parser/js/lib/results.js (limited to 'node_modules/ua-parser/js/lib/results.js') 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 : ''); +}; -- cgit