Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lil-wingman

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lil-wingman - npm Package Compare versions

Comparing version 0.5.2 to 0.6.0

dist/index.cjs

15

dist/index.d.ts

@@ -0,1 +1,14 @@

import UAParser from 'ua-parser-js';
declare function getUserAgent(): UAParser.IResult;
declare function getUrlParams<T extends Record<string, any>>(query: string): T;
declare function copyToClipboard(text: string): Promise<void>;
declare function clearCookies(): void;
declare function getSelectedText(): string | undefined;
declare function isDarkMode(): boolean;
declare function gotoTop(): void;
declare function isTabActivate(): boolean;
declare function isAtBottom(): boolean;
declare function isIE(): boolean;
type Rgb = [number, number, number];

@@ -26,2 +39,2 @@ declare function rgbToHex(rgb: Rgb): string;

export { TreeNode, arrayToTree, arrayToTreeReduce, capitalize, hasOwnProperty, hexToRgb, isAsyncFunction, isBlank, isDate, isFunction, isPromise, isRegExp, randomHexColor, reverse, rgbToHex, stripHtml, truncateString };
export { TreeNode, arrayToTree, arrayToTreeReduce, capitalize, clearCookies, copyToClipboard, getSelectedText, getUrlParams, getUserAgent, gotoTop, hasOwnProperty, hexToRgb, isAsyncFunction, isAtBottom, isBlank, isDarkMode, isDate, isFunction, isIE, isPromise, isRegExp, isTabActivate, randomHexColor, reverse, rgbToHex, stripHtml, truncateString };

2

dist/index.js

@@ -1,1 +0,1 @@

"use strict";var t=Object.prototype.toString;function r(r,n){return Array.isArray(n)?n.map((function(t){return"[object ".concat(t,"]")})).includes(t.call(r)):t.call(r)==="[object ".concat(n,"]")}function n(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);r&&(e=e.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),n.push.apply(n,e)}return n}function e(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?n(Object(e),!0).forEach((function(r){o(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):n(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}function o(t,r,n){return(r=function(t){var r=function(t,r){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var e=n.call(t,r||"default");if("object"!=typeof e)return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:String(r)}(r))in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function i(t){return function(t){if(Array.isArray(t))return c(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,r){if(!t)return;if("string"==typeof t)return c(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(t,r)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t,r){(null==r||r>t.length)&&(r=t.length);for(var n=0,e=new Array(r);n<r;n++)e[n]=t[n];return e}exports.arrayToTree=function t(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"parentId",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"id",c=[];return r.forEach((function(u){if(u[o]===n){var a=e({},u),s=t(r,u[i],o,i);s.length>0&&(a.children=s),c.push(a)}})),c},exports.arrayToTreeReduce=function t(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"parentId",c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"id";return r.reduce((function(u,a){return a[o]===n?[].concat(i(u),[e(e({},a),{},{children:t(r,a[c],o,c)})]):u}),[])},exports.capitalize=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},exports.hasOwnProperty=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},exports.hexToRgb=function(t){var r,n;return null!==(r=null===(n=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,r,n,e){return"#".concat(r).concat(r).concat(n).concat(n).concat(e).concat(e)})).substring(1).match(/.{2}/g))||void 0===n?void 0:n.map((function(t){return parseInt(t,16)})))&&void 0!==r?r:[0,0,0]},exports.isAsyncFunction=function(t){return r(t,"AsyncFunction")},exports.isBlank=function(t){return!!(function(t){return!t}(t)||function(t){return"string"==typeof t&&/^\s*$/.test(t)}(t)||function(t){return Array.isArray(t)&&0===t.length}(t)||function(t){return function(t){return r(t,"Object")}(t)&&0===Reflect.ownKeys(t).length}(t)||function(t){return t instanceof Date&&Number.isNaN(t.getTime())}(t)||function(t){return t instanceof Set&&0===t.size}(t)||function(t){return t instanceof Map&&0===t.size}(t))},exports.isDate=function(t){return r(t,"Date")},exports.isFunction=function(t){return r(t,["Function","GeneratorFunction","AsyncFunction","Promise"])},exports.isPromise=function(t){return r(t,"Promise")},exports.isRegExp=function(t){return r(t,"RegExp")},exports.randomHexColor=function(){return"#"+(1048575*Math.random()*1e6).toString(16).slice(0,6)},exports.reverse=function(t){return t.split("").reverse().join("")},exports.rgbToHex=function(t){return"#"+((1<<24)+(t[0]<<16)+(t[1]<<8)+t[2]).toString(16).slice(1)},exports.stripHtml=function(t){return(new DOMParser).parseFromString(t,"text/html").body.textContent||""},exports.truncateString=function(t,r){return t.length<r?t:"".concat(t.slice(0,r-3),"...")};
!function(i,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((i="undefined"!=typeof globalThis?globalThis:i||self).wingman={})}(this,(function(i){"use strict";function e(i,e){var r=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),r.push.apply(r,n)}return r}function r(i){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?e(Object(n),!0).forEach((function(e){t(i,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(n)):e(Object(n)).forEach((function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(n,e))}))}return i}function n(i){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(i){return typeof i}:function(i){return i&&"function"==typeof Symbol&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},n(i)}function t(i,e,r){return(e=function(i){var e=function(i,e){if("object"!=typeof i||null===i)return i;var r=i[Symbol.toPrimitive];if(void 0!==r){var n=r.call(i,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(i)}(i,"string");return"symbol"==typeof e?e:String(e)}(e))in i?Object.defineProperty(i,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):i[e]=r,i}function o(i,e){return function(i){if(Array.isArray(i))return i}(i)||function(i,e){var r=null==i?null:"undefined"!=typeof Symbol&&i[Symbol.iterator]||i["@@iterator"];if(null!=r){var n,t,o,a,s=[],c=!0,u=!1;try{if(o=(r=r.call(i)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==e);c=!0);}catch(i){u=!0,t=i}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw t}}return s}}(i,e)||s(i,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(i){return function(i){if(Array.isArray(i))return c(i)}(i)||function(i){if("undefined"!=typeof Symbol&&null!=i[Symbol.iterator]||null!=i["@@iterator"])return Array.from(i)}(i)||s(i)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(i,e){if(i){if("string"==typeof i)return c(i,e);var r=Object.prototype.toString.call(i).slice(8,-1);return"Object"===r&&i.constructor&&(r=i.constructor.name),"Map"===r||"Set"===r?Array.from(i):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(i,e):void 0}}function c(i,e){(null==e||e>i.length)&&(e=i.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=i[r];return n}var u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},l={};!function(i,e){!function(r,t){var o="function",a="undefined",s="object",c="string",u="model",l="name",b="type",d="vendor",w="version",f="architecture",p="console",m="mobile",h="tablet",g="smarttv",v="wearable",y="embedded",x="Amazon",k="Apple",S="ASUS",T="BlackBerry",O="Browser",j="Chrome",A="Firefox",_="Google",P="Huawei",E="LG",N="Microsoft",z="Motorola",q="Opera",C="Samsung",R="Sharp",U="Sony",M="Xiaomi",D="Zebra",I="Facebook",F=function(i){for(var e={},r=0;r<i.length;r++)e[i[r].toUpperCase()]=i[r];return e},B=function(i,e){return n(i)===c&&-1!==V(e).indexOf(V(i))},V=function(i){return i.toLowerCase()},H=function(i,e){if(n(i)===c)return i=i.replace(/^\s\s*/,""),n(e)===a?i:i.substring(0,350)},$=function(i,e){for(var r,a,c,u,l,b,d=0;d<e.length&&!l;){var w=e[d],f=e[d+1];for(r=a=0;r<w.length&&!l;)if(l=w[r++].exec(i))for(c=0;c<f.length;c++)b=l[++a],n(u=f[c])===s&&u.length>0?2===u.length?n(u[1])==o?this[u[0]]=u[1].call(this,b):this[u[0]]=u[1]:3===u.length?n(u[1])!==o||u[1].exec&&u[1].test?this[u[0]]=b?b.replace(u[1],u[2]):t:this[u[0]]=b?u[1].call(this,b,u[2]):t:4===u.length&&(this[u[0]]=b?u[3].call(this,b.replace(u[1],u[2])):t):this[u]=b||t;d+=2}},G=function(i,e){for(var r in e)if(n(e[r])===s&&e[r].length>0){for(var o=0;o<e[r].length;o++)if(B(e[r][o],i))return"?"===r?t:r}else if(B(e[r],i))return"?"===r?t:r;return i},L={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},W={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[w,[l,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[w,[l,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[l,w],[/opios[\/ ]+([\w\.]+)/i],[w,[l,q+" Mini"]],[/\bopr\/([\w\.]+)/i],[w,[l,q]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[l,w],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[w,[l,"UC"+O]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[w,[l,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[w,[l,"WeChat"]],[/konqueror\/([\w\.]+)/i],[w,[l,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[w,[l,"IE"]],[/yabrowser\/([\w\.]+)/i],[w,[l,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[l,/(.+)/,"$1 Secure "+O],w],[/\bfocus\/([\w\.]+)/i],[w,[l,A+" Focus"]],[/\bopt\/([\w\.]+)/i],[w,[l,q+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[w,[l,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[w,[l,"Dolphin"]],[/coast\/([\w\.]+)/i],[w,[l,q+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[w,[l,"MIUI "+O]],[/fxios\/([-\w\.]+)/i],[w,[l,A]],[/\bqihu|(qi?ho?o?|360)browser/i],[[l,"360 "+O]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[l,/(.+)/,"$1 "+O],w],[/(comodo_dragon)\/([\w\.]+)/i],[[l,/_/g," "],w],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[l,w],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[l],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[l,I],w],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[l,w],[/\bgsa\/([\w\.]+) .*safari\//i],[w,[l,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[w,[l,j+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[l,j+" WebView"],w],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[w,[l,"Android "+O]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[l,w],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[w,[l,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[w,l],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[l,[w,G,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[l,w],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[l,"Netscape"],w],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[w,[l,A+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[l,w],[/(cobalt)\/([\w\.]+)/i],[l,[w,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[f,"amd64"]],[/(ia32(?=;))/i],[[f,V]],[/((?:i[346]|x)86)[;\)]/i],[[f,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[f,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[f,"armhf"]],[/windows (ce|mobile); ppc;/i],[[f,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[f,/ower/,"",V]],[/(sun4\w)[;\)]/i],[[f,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[f,V]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[u,[d,C],[b,h]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[u,[d,C],[b,m]],[/\((ip(?:hone|od)[\w ]*);/i],[u,[d,k],[b,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[d,k],[b,h]],[/(macintosh);/i],[u,[d,k]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[u,[d,P],[b,h]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[d,P],[b,m]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[u,/_/g," "],[d,M],[b,m]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[u,/_/g," "],[d,M],[b,h]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[u,[d,"OPPO"],[b,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[d,"Vivo"],[b,m]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[u,[d,"Realme"],[b,m]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[u,[d,z],[b,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[d,z],[b,h]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[d,E],[b,h]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[d,E],[b,m]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[u,[d,"Lenovo"],[b,h]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[u,/_/g," "],[d,"Nokia"],[b,m]],[/(pixel c)\b/i],[u,[d,_],[b,h]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[d,_],[b,m]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[u,[d,U],[b,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[d,U],[b,h]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[d,"OnePlus"],[b,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[d,x],[b,h]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[d,x],[b,m]],[/(playbook);[-\w\),; ]+(rim)/i],[u,d,[b,h]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[d,T],[b,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[d,S],[b,h]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[d,S],[b,m]],[/(nexus 9)/i],[u,[d,"HTC"],[b,h]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[d,[u,/_/g," "],[b,m]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[d,"Acer"],[b,h]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[d,"Meizu"],[b,m]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[d,R],[b,m]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[d,u,[b,m]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[d,u,[b,h]],[/(surface duo)/i],[u,[d,N],[b,h]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[d,"Fairphone"],[b,m]],[/(u304aa)/i],[u,[d,"AT&T"],[b,m]],[/\bsie-(\w*)/i],[u,[d,"Siemens"],[b,m]],[/\b(rct\w+) b/i],[u,[d,"RCA"],[b,h]],[/\b(venue[\d ]{2,7}) b/i],[u,[d,"Dell"],[b,h]],[/\b(q(?:mv|ta)\w+) b/i],[u,[d,"Verizon"],[b,h]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[d,"Barnes & Noble"],[b,h]],[/\b(tm\d{3}\w+) b/i],[u,[d,"NuVision"],[b,h]],[/\b(k88) b/i],[u,[d,"ZTE"],[b,h]],[/\b(nx\d{3}j) b/i],[u,[d,"ZTE"],[b,m]],[/\b(gen\d{3}) b.+49h/i],[u,[d,"Swiss"],[b,m]],[/\b(zur\d{3}) b/i],[u,[d,"Swiss"],[b,h]],[/\b((zeki)?tb.*\b) b/i],[u,[d,"Zeki"],[b,h]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[d,"Dragon Touch"],u,[b,h]],[/\b(ns-?\w{0,9}) b/i],[u,[d,"Insignia"],[b,h]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[d,"NextBook"],[b,h]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[d,"Voice"],u,[b,m]],[/\b(lvtel\-)?(v1[12]) b/i],[[d,"LvTel"],u,[b,m]],[/\b(ph-1) /i],[u,[d,"Essential"],[b,m]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[d,"Envizen"],[b,h]],[/\b(trio[-\w\. ]+) b/i],[u,[d,"MachSpeed"],[b,h]],[/\btu_(1491) b/i],[u,[d,"Rotor"],[b,h]],[/(shield[\w ]+) b/i],[u,[d,"Nvidia"],[b,h]],[/(sprint) (\w+)/i],[d,u,[b,m]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[d,N],[b,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[d,D],[b,h]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[d,D],[b,m]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[d,u,[b,p]],[/droid.+; (shield) bui/i],[u,[d,"Nvidia"],[b,p]],[/(playstation [345portablevi]+)/i],[u,[d,U],[b,p]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[d,N],[b,p]],[/smart-tv.+(samsung)/i],[d,[b,g]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[d,C],[b,g]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[d,E],[b,g]],[/(apple) ?tv/i],[d,[u,k+" TV"],[b,g]],[/crkey/i],[[u,j+"cast"],[d,_],[b,g]],[/droid.+aft(\w)( bui|\))/i],[u,[d,x],[b,g]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[d,R],[b,g]],[/(bravia[\w ]+)( bui|\))/i],[u,[d,U],[b,g]],[/(mitv-\w{5}) bui/i],[u,[d,M],[b,g]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[d,H],[u,H],[b,g]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[b,g]],[/((pebble))app/i],[d,u,[b,v]],[/droid.+; (glass) \d/i],[u,[d,_],[b,v]],[/droid.+; (wt63?0{2,3})\)/i],[u,[d,D],[b,v]],[/(quest( 2)?)/i],[u,[d,I],[b,v]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[d,[b,y]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[u,[b,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[b,h]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[b,h]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[b,m]],[/(android[-\w\. ]{0,9});.+buil/i],[u,[d,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[w,[l,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[w,[l,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[l,w],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[w,l]],os:[[/microsoft (windows) (vista|xp)/i],[l,w],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[l,[w,G,L]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[l,"Windows"],[w,G,L]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[w,/_/g,"."],[l,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[l,"Mac OS"],[w,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[w,l],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[l,w],[/\(bb(10);/i],[w,[l,T]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[w,[l,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[w,[l,A+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[w,[l,"webOS"]],[/crkey\/([\d\.]+)/i],[w,[l,j+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[l,"Chromium OS"],w],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[l,w],[/(sunos) ?([\w\.\d]*)/i],[[l,"Solaris"],w],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[l,w]]},Z=function i(e,o){if(n(e)===s&&(o=e,e=t),!(this instanceof i))return new i(e,o).getResult();var p=e||(n(r)!==a&&r.navigator&&r.navigator.userAgent?r.navigator.userAgent:""),m=o?function(i,e){var r={};for(var n in i)e[n]&&e[n].length%2==0?r[n]=e[n].concat(i[n]):r[n]=i[n];return r}(W,o):W;return this.getBrowser=function(){var i,e={};return e[l]=t,e[w]=t,$.call(e,p,m.browser),e.major=n(i=e.version)===c?i.replace(/[^\d\.]/g,"").split(".")[0]:t,e},this.getCPU=function(){var i={};return i[f]=t,$.call(i,p,m.cpu),i},this.getDevice=function(){var i={};return i[d]=t,i[u]=t,i[b]=t,$.call(i,p,m.device),i},this.getEngine=function(){var i={};return i[l]=t,i[w]=t,$.call(i,p,m.engine),i},this.getOS=function(){var i={};return i[l]=t,i[w]=t,$.call(i,p,m.os),i},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return p},this.setUA=function(i){return p=n(i)===c&&i.length>350?H(i,350):i,this},this.setUA(p),this};Z.VERSION="1.0.33",Z.BROWSER=F([l,w,"major"]),Z.CPU=F([f]),Z.DEVICE=F([u,d,b,p,m,g,h,v,y]),Z.ENGINE=Z.OS=F([l,w]),i.exports&&(e=i.exports=Z),e.UAParser=Z;var X=n(r)!==a&&(r.jQuery||r.Zepto);if(X&&!X.ua){var K=new Z;X.ua=K.getResult(),X.ua.get=function(){return K.getUA()},X.ua.set=function(i){K.setUA(i);var e=K.getResult();for(var r in e)X.ua[r]=e[r]}}}("object"===("undefined"==typeof window?"undefined":n(window))?window:u)}({get exports(){return l},set exports(i){l=i}},l);var b=l;var d=Object.prototype.toString;function w(i,e){return Array.isArray(e)?e.map((function(i){return"[object ".concat(i,"]")})).includes(d.call(i)):d.call(i)==="[object ".concat(e,"]")}i.arrayToTree=function i(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"parentId",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"id",a=[];return e.forEach((function(s){if(s[t]===n){var c=r({},s),u=i(e,s[o],t,o);u.length>0&&(c.children=u),a.push(c)}})),a},i.arrayToTreeReduce=function i(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"parentId",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"id";return e.reduce((function(s,c){return c[t]===n?[].concat(a(s),[r(r({},c),{},{children:i(e,c[o],t,o)})]):s}),[])},i.capitalize=function(i){return i.charAt(0).toUpperCase()+i.slice(1)},i.clearCookies=function(){document.cookie.split(";").forEach((function(i){return document.cookie=i.replace(/^ +/,"").replace(/=.*/,"=;expires=".concat((new Date).toUTCString(),";path=/"))}))},i.copyToClipboard=function(i){return navigator&&navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(i):Promise.reject("The Clipboard API is not support.")},i.getSelectedText=function(){var i;return null===(i=window.getSelection())||void 0===i?void 0:i.toString()},i.getUrlParams=function(i){return Array.from(new URLSearchParams(i)).reduce((function(i,e){var r=o(e,2),n=r[0],a=r[1];return Object.assign({},i,t({},n,i[n]?(Array.isArray(i[n])?i[n]:[i[n]]).concat(a):a))}),Object.create(null))},i.getUserAgent=function(){return(new b).getResult()},i.gotoTop=function(){window.scrollTo(0,0)},i.hasOwnProperty=function(i,e){return Object.prototype.hasOwnProperty.call(i,e)},i.hexToRgb=function(i){var e,r;return null!==(e=null===(r=i.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(i,e,r,n){return"#".concat(e).concat(e).concat(r).concat(r).concat(n).concat(n)})).substring(1).match(/.{2}/g))||void 0===r?void 0:r.map((function(i){return parseInt(i,16)})))&&void 0!==e?e:[0,0,0]},i.isAsyncFunction=function(i){return w(i,"AsyncFunction")},i.isAtBottom=function(){return document.documentElement.clientHeight+window.scrollY>=document.documentElement.scrollHeight},i.isBlank=function(i){return!!(function(i){return!i}(i)||function(i){return"string"==typeof i&&/^\s*$/.test(i)}(i)||function(i){return Array.isArray(i)&&0===i.length}(i)||function(i){return function(i){return w(i,"Object")}(i)&&0===Reflect.ownKeys(i).length}(i)||function(i){return i instanceof Date&&Number.isNaN(i.getTime())}(i)||function(i){return i instanceof Set&&0===i.size}(i)||function(i){return i instanceof Map&&0===i.size}(i))},i.isDarkMode=function(){return window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches},i.isDate=function(i){return w(i,"Date")},i.isFunction=function(i){return w(i,["Function","GeneratorFunction","AsyncFunction","Promise"])},i.isIE=function(){return!!document.documentMode},i.isPromise=function(i){return w(i,"Promise")},i.isRegExp=function(i){return w(i,"RegExp")},i.isTabActivate=function(){return!document.hidden},i.randomHexColor=function(){return"#"+(1048575*Math.random()*1e6).toString(16).slice(0,6)},i.reverse=function(i){return i.split("").reverse().join("")},i.rgbToHex=function(i){return"#"+((1<<24)+(i[0]<<16)+(i[1]<<8)+i[2]).toString(16).slice(1)},i.stripHtml=function(i){return(new DOMParser).parseFromString(i,"text/html").body.textContent||""},i.truncateString=function(i,e){return i.length<e?i:"".concat(i.slice(0,e-3),"...")}}));

@@ -0,1 +1,3 @@

import UAParser from "ua-parser-js";
export declare function getUserAgent(): UAParser.IResult;
export declare function getUrlParams<T extends Record<string, any>>(query: string): T;

@@ -2,0 +4,0 @@ export declare function copyToClipboard(text: string): Promise<void>;

@@ -0,1 +1,2 @@

export * from "./browser";
export * from "./convert";

@@ -2,0 +3,0 @@ export * from "./judges";

{
"name": "lil-wingman",
"version": "0.5.2",
"version": "0.6.0",
"license": "MIT",

@@ -22,3 +22,3 @@ "author": "lucystwt",

],
"main": "dist/index.js",
"main": "dist/index.cjs",
"module": "dist/index.mjs",

@@ -33,4 +33,4 @@ "types": "dist/index.d.ts",

"scripts": {
"build": "pnpm clean && pnpm build:types && rollup -c",
"build:types": "tsc -b ./tsconfig.types.json",
"dev": "rollup -c -w",
"build": "rimraf dist && rollup -c",
"test": "jest",

@@ -41,3 +41,2 @@ "test:coverage": "jest --coverage",

"check": "tsc -p tsconfig.json --noEmit",
"clean": "rimraf dist",
"ci": "pnpm build && pnpm test && pnpm lint && pnpm check",

@@ -47,2 +46,5 @@ "prepublishOnly": "pnpm ci",

},
"dependencies": {
"ua-parser-js": "^1.0.33"
},
"devDependencies": {

@@ -60,2 +62,3 @@ "@babel/core": "^7.20.12",

"@types/jest": "^29.2.5",
"@types/ua-parser-js": "^0.7.36",
"@typescript-eslint/eslint-plugin": "^5.48.1",

@@ -62,0 +65,0 @@ "@typescript-eslint/parser": "^5.48.1",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc