Skip to content

Commit

Permalink
Move feature detection to its own dedicated method
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalman committed Apr 5, 2023
1 parent 4711805 commit b385a73
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/ua-parser.js
Expand Up @@ -964,14 +964,7 @@
}
return this;
}
UAParserItem.prototype.get = function (prop) {
if (!prop) return this.data;
return this.data.hasOwnProperty(prop) ? this.data[prop] : undefined;
};
UAParserItem.prototype.parseUA = function () {
if (this.itemType != UA_RESULT) {
rgxMapper.call(this.data, this.ua, this.rgxMap);
}
UAParserItem.prototype.detectFeature = function () {
var isSelfNav = NAVIGATOR && NAVIGATOR.userAgent == this.ua;
switch(this.itemType) {
case UA_BROWSER:
Expand All @@ -998,6 +991,17 @@
}
return this;
};
UAParserItem.prototype.get = function (prop) {
if (!prop) return this.data;
return this.data.hasOwnProperty(prop) ? this.data[prop] : undefined;
};
UAParserItem.prototype.parseUA = function () {
if (this.itemType != UA_RESULT) {
rgxMapper.call(this.data, this.ua, this.rgxMap);
}
this.detectFeature();
return this;
};
UAParserItem.prototype.parseCH = function () {
var ua = this.ua,
uaCH = this.uaCH,
Expand Down

0 comments on commit b385a73

Please sign in to comment.