UNPKG

user-device-type

Version:

**Browser, OS, and device detection based on the available user agent string. Can be used both in a browser (also as a standalone script) or in a server environment.**

2 lines (1 loc) 898 B
(function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e["device-type"]={}))})(this,function(e){"use strict";function t(o){const i=/Mobile|Android|iP(hone|od)|BlackBerry|IEMobile|Silk|Opera Mini|Fennec|webOS|Windows Phone|PlayStation Vita/i,n=/Tablet|iPad|Nexus 7|Nexus 9|Kindle|Silk|Fennec/i,s=/Win(dows NT|dows NT 10.0|dows NT 6.1|dows NT 6.2|dows NT 6.3|dows NT 5.1|dows NT 5.2|dows NT 6.0|dows NT 5.0)|Macintosh|Intel Mac OS X|Linux|Ubuntu|CrOS/i,l=/SmartTV|AppleTV|GoogleTV|HbbTV|NetCast|WebTV|Tizen|Roku|Xbox|PlayStation|CrKey|DIAL/i;return/Watch|Wearable|Google Glass|SmartWatch|Gear/i.test(o)?"wearable":l.test(o)?"tv":n.test(o)?"tablet":i.test(o)?"mobile":s.test(o)?"desktop":"unknown"}e.getDeviceType=t,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});