Move feature detection to its own dedicated method

This commit is contained in:
Faisal Salman 2023-04-05 23:29:27 +07:00
parent 4711805a1c
commit b385a73340

View File

@ -964,14 +964,7 @@
} }
return this; return this;
} }
UAParserItem.prototype.get = function (prop) { UAParserItem.prototype.detectFeature = function () {
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);
}
var isSelfNav = NAVIGATOR && NAVIGATOR.userAgent == this.ua; var isSelfNav = NAVIGATOR && NAVIGATOR.userAgent == this.ua;
switch(this.itemType) { switch(this.itemType) {
case UA_BROWSER: case UA_BROWSER:
@ -998,6 +991,17 @@
} }
return this; 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 () { UAParserItem.prototype.parseCH = function () {
var ua = this.ua, var ua = this.ua,
uaCH = this.uaCH, uaCH = this.uaCH,