description and source-codefunction UAParser(uastring) {
if (!(this instanceof UAParser)) return new UAParser(uastring).getResult();
var ua = uastring || ((window && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY);
if (!(this instanceof UAParser)) {
return new UAParser(uastring).getResult();
}
this.getBrowser = function () {
return mapper.rgx.apply(this, regexes.browser);
};
this.getCPU = function () {
return mapper.rgx.apply(this, regexes.cpu);
};
this.getDevice = function () {
return mapper.rgx.apply(this, regexes.device);
};
this.getEngine = function () {
return mapper.rgx.apply(this, regexes.engine);
};
this.getOS = function () {
return mapper.rgx.apply(this, regexes.os);
};
this.getResult = function() {
return {
browser : this.getBrowser(),
engine : this.getEngine(),
os : this.getOS(),
device : this.getDevice(),
cpu : this.getCPU()
};
};
this.getUA = function () {
return ua;
};
this.setUA = function (uastring) {
ua = uastring;
return this;
};
this.setUA(ua);
}