isomorphic-user-agent
Advanced tools
Comparing version 1.0.2 to 2.0.0
@@ -1,1 +0,1 @@ | ||
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.IsomophicUserAgent=r():e.IsomophicUserAgent=r()}(this,function(){return function(e){function r(n){if(t[n])return t[n].exports;var i=t[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}var t={};return r.m=e,r.c=t,r.p="",r(0)}([function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=t(3),o=n(i);r.default=o.default},function(e,r){r.endianness=function(){return"LE"},r.hostname=function(){return"undefined"!=typeof location?location.hostname:""},r.loadavg=function(){return[]},r.uptime=function(){return 0},r.freemem=function(){return Number.MAX_VALUE},r.totalmem=function(){return Number.MAX_VALUE},r.cpus=function(){return[]},r.type=function(){return"Browser"},r.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},r.networkInterfaces=r.getNetworkInterfaces=function(){return{}},r.arch=function(){return"javascript"},r.platform=function(){return"browser"},r.tmpdir=r.tmpDir=function(){return"/tmp"},r.EOL="\n"},function(e,r){function t(){c=!1,s.length?u=s.concat(u):p=-1,u.length&&n()}function n(){if(!c){var e=setTimeout(t);c=!0;for(var r=u.length;r;){for(s=u,u=[];++p<r;)s&&s[p].run();p=-1,r=u.length}s=null,c=!1,clearTimeout(e)}}function i(e,r){this.fun=e,this.array=r}function o(){}var s,a=e.exports={},u=[],c=!1,p=-1;a.nextTick=function(e){var r=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)r[t-1]=arguments[t];u.push(new i(e,r)),1!==u.length||c||setTimeout(n,0)},i.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=o,a.addListener=o,a.once=o,a.off=o,a.removeListener=o,a.removeAllListeners=o,a.emit=o,a.binding=function(e){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(e){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=t(4),o=n(i);r.default=function(){return"undefined"!=typeof window&&null!==window&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:(0,o.default)()}},function(e,r,t){(function(r){"use strict";var n=t(5),i="Node.js/"+r.version.slice(1)+" ("+n()+"; "+r.arch+")";e.exports=function(e,r){return 2!==arguments.length?i:e+"/"+r+" "+i}}).call(r,t(2))},function(e,r,t){"use strict";var n=t(1),i=t(6),o=t(8);e.exports=function(e,r){if(!e&&r)throw new Error("You can't specify a `release` without specfying `platform`");e=e||n.platform(),r=r||n.release();var t;return"darwin"===e?(t=i(r).name,"OS X"+(t?" "+t:"")):"linux"===e?(t=r.replace(/^(\d+\.\d+).*/,"$1"),"Linux"+(t?" "+t:"")):"win32"===e?(t=o(r),"Windows"+(t?" "+t:"")):e}},function(e,r,t){"use strict";var n=t(1),i={15:"El Capitan",14:"Yosemite",13:"Mavericks",12:"Mountain Lion",11:"Lion",10:"Snow Leopard",9:"Leopard",8:"Tiger",7:"Panther",6:"Jaguar",5:"Puma"};e.exports=function(e){return e=(e||n.release()).split(".")[0],{name:i[e],version:"10."+(Number(e)-4)}}},function(e,r,t){(function(t){function n(e,r){if(e instanceof s)return e;if("string"!=typeof e)return null;if(e.length>F)return null;var t=r?J[le]:J[ce];if(!t.test(e))return null;try{return new s(e,r)}catch(n){return null}}function i(e,r){var t=n(e,r);return t?t.version:null}function o(e,r){var t=n(e.trim().replace(/^[=v]+/,""),r);return t?t.version:null}function s(e,r){if(e instanceof s){if(e.loose===r)return e;e=e.version}else if("string"!=typeof e)throw new TypeError("Invalid Version: "+e);if(e.length>F)throw new TypeError("version is longer than "+F+" characters");if(!(this instanceof s))return new s(e,r);q("SemVer",e,r),this.loose=r;var t=e.trim().match(r?J[le]:J[ce]);if(!t)throw new TypeError("Invalid Version: "+e);if(this.raw=e,this.major=+t[1],this.minor=+t[2],this.patch=+t[3],this.major>Y||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Y||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Y||this.patch<0)throw new TypeError("Invalid patch version");t[4]?this.prerelease=t[4].split(".").map(function(e){if(/^[0-9]+$/.test(e)){var r=+e;if(r>=0&&Y>r)return r}return e}):this.prerelease=[],this.build=t[5]?t[5].split("."):[],this.format()}function a(e,r,t,n){"string"==typeof t&&(n=t,t=void 0);try{return new s(e,t).inc(r,n).version}catch(i){return null}}function u(e,r){if(E(e,r))return null;var t=n(e),i=n(r);if(t.prerelease.length||i.prerelease.length){for(var o in t)if(("major"===o||"minor"===o||"patch"===o)&&t[o]!==i[o])return"pre"+o;return"prerelease"}for(var o in t)if(("major"===o||"minor"===o||"patch"===o)&&t[o]!==i[o])return o}function c(e,r){var t=Pe.test(e),n=Pe.test(r);return t&&n&&(e=+e,r=+r),t&&!n?-1:n&&!t?1:r>e?-1:e>r?1:0}function p(e,r){return c(r,e)}function f(e,r){return new s(e,r).major}function l(e,r){return new s(e,r).minor}function h(e,r){return new s(e,r).patch}function v(e,r,t){return new s(e,t).compare(r)}function m(e,r){return v(e,r,!0)}function d(e,r,t){return v(r,e,t)}function g(e,t){return e.sort(function(e,n){return r.compare(e,n,t)})}function w(e,t){return e.sort(function(e,n){return r.rcompare(e,n,t)})}function y(e,r,t){return v(e,r,t)>0}function b(e,r,t){return v(e,r,t)<0}function E(e,r,t){return 0===v(e,r,t)}function j(e,r,t){return 0!==v(e,r,t)}function x(e,r,t){return v(e,r,t)>=0}function k(e,r,t){return v(e,r,t)<=0}function $(e,r,t,n){var i;switch(r){case"===":"object"==typeof e&&(e=e.version),"object"==typeof t&&(t=t.version),i=e===t;break;case"!==":"object"==typeof e&&(e=e.version),"object"==typeof t&&(t=t.version),i=e!==t;break;case"":case"=":case"==":i=E(e,t,n);break;case"!=":i=j(e,t,n);break;case">":i=y(e,t,n);break;case">=":i=x(e,t,n);break;case"<":i=b(e,t,n);break;case"<=":i=k(e,t,n);break;default:throw new TypeError("Invalid operator: "+r)}return i}function _(e,r){if(e instanceof _){if(e.loose===r)return e;e=e.value}return this instanceof _?(q("comparator",e,r),this.loose=r,this.parse(e),this.semver===Ue?this.value="":this.value=this.operator+this.semver.version,void q("comp",this)):new _(e,r)}function A(e,r){if(e instanceof A&&e.loose===r)return e;if(!(this instanceof A))return new A(e,r);if(this.loose=r,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map(function(e){return this.parseRange(e.trim())},this).filter(function(e){return e.length}),!this.set.length)throw new TypeError("Invalid SemVer Range: "+e);this.format()}function S(e,r){return new A(e,r).set.map(function(e){return e.map(function(e){return e.value}).join(" ").trim().split(" ")})}function T(e,r){return q("comp",e),e=L(e,r),q("caret",e),e=M(e,r),q("tildes",e),e=V(e,r),q("xrange",e),e=C(e,r),q("stars",e),e}function I(e){return!e||"x"===e.toLowerCase()||"*"===e}function M(e,r){return e.trim().split(/\s+/).map(function(e){return R(e,r)}).join(" ")}function R(e,r){var t=r?J[ke]:J[xe];return e.replace(t,function(r,t,n,i,o){q("tilde",e,r,t,n,i,o);var s;return I(t)?s="":I(n)?s=">="+t+".0.0 <"+(+t+1)+".0.0":I(i)?s=">="+t+"."+n+".0 <"+t+"."+(+n+1)+".0":o?(q("replaceTilde pr",o),"-"!==o.charAt(0)&&(o="-"+o),s=">="+t+"."+n+"."+i+o+" <"+t+"."+(+n+1)+".0"):s=">="+t+"."+n+"."+i+" <"+t+"."+(+n+1)+".0",q("tilde return",s),s})}function L(e,r){return e.trim().split(/\s+/).map(function(e){return N(e,r)}).join(" ")}function N(e,r){q("caret",e,r);var t=r?J[Te]:J[Se];return e.replace(t,function(r,t,n,i,o){q("caret",e,r,t,n,i,o);var s;return I(t)?s="":I(n)?s=">="+t+".0.0 <"+(+t+1)+".0.0":I(i)?s="0"===t?">="+t+"."+n+".0 <"+t+"."+(+n+1)+".0":">="+t+"."+n+".0 <"+(+t+1)+".0.0":o?(q("replaceCaret pr",o),"-"!==o.charAt(0)&&(o="-"+o),s="0"===t?"0"===n?">="+t+"."+n+"."+i+o+" <"+t+"."+n+"."+(+i+1):">="+t+"."+n+"."+i+o+" <"+t+"."+(+n+1)+".0":">="+t+"."+n+"."+i+o+" <"+(+t+1)+".0.0"):(q("no pr"),s="0"===t?"0"===n?">="+t+"."+n+"."+i+" <"+t+"."+n+"."+(+i+1):">="+t+"."+n+"."+i+" <"+t+"."+(+n+1)+".0":">="+t+"."+n+"."+i+" <"+(+t+1)+".0.0"),q("caret return",s),s})}function V(e,r){return q("replaceXRanges",e,r),e.split(/\s+/).map(function(e){return O(e,r)}).join(" ")}function O(e,r){e=e.trim();var t=r?J[ye]:J[we];return e.replace(t,function(r,t,n,i,o,s){q("xRange",e,r,t,n,i,o,s);var a=I(n),u=a||I(i),c=u||I(o),p=c;return"="===t&&p&&(t=""),a?r=">"===t||"<"===t?"<0.0.0":"*":t&&p?(u&&(i=0),c&&(o=0),">"===t?(t=">=",u?(n=+n+1,i=0,o=0):c&&(i=+i+1,o=0)):"<="===t&&(t="<",u?n=+n+1:i=+i+1),r=t+n+"."+i+"."+o):u?r=">="+n+".0.0 <"+(+n+1)+".0.0":c&&(r=">="+n+"."+i+".0 <"+n+"."+(+i+1)+".0"),q("xRange return",r),r})}function C(e,r){return q("replaceStars",e,r),e.trim().replace(J[Oe],"")}function P(e,r,t,n,i,o,s,a,u,c,p,f,l){return r=I(t)?"":I(n)?">="+t+".0.0":I(i)?">="+t+"."+n+".0":">="+r,a=I(u)?"":I(c)?"<"+(+u+1)+".0.0":I(p)?"<"+u+"."+(+c+1)+".0":f?"<="+u+"."+c+"."+p+"-"+f:"<="+a,(r+" "+a).trim()}function U(e,r){for(var t=0;t<e.length;t++)if(!e[t].test(r))return!1;if(r.prerelease.length){for(var t=0;t<e.length;t++)if(q(e[t].semver),e[t].semver!==Ue&&e[t].semver.prerelease.length>0){var n=e[t].semver;if(n.major===r.major&&n.minor===r.minor&&n.patch===r.patch)return!0}return!1}return!0}function X(e,r,t){try{r=new A(r,t)}catch(n){return!1}return r.test(e)}function D(e,r,t){return e.filter(function(e){return X(e,r,t)}).sort(function(e,r){return d(e,r,t)})[0]||null}function z(e,r){try{return new A(e,r).range||"*"}catch(t){return null}}function B(e,r,t){return Z(e,r,"<",t)}function G(e,r,t){return Z(e,r,">",t)}function Z(e,r,t,n){e=new s(e,n),r=new A(r,n);var i,o,a,u,c;switch(t){case">":i=y,o=k,a=b,u=">",c=">=";break;case"<":i=b,o=x,a=y,u="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(X(e,r,n))return!1;for(var p=0;p<r.set.length;++p){var f=r.set[p],l=null,h=null;if(f.forEach(function(e){e.semver===Ue&&(e=new _(">=0.0.0")),l=l||e,h=h||e,i(e.semver,l.semver,n)?l=e:a(e.semver,h.semver,n)&&(h=e)}),l.operator===u||l.operator===c)return!1;if((!h.operator||h.operator===u)&&o(e,h.semver))return!1;if(h.operator===c&&a(e,h.semver))return!1}return!0}r=e.exports=s;var q;q="object"==typeof t&&t.env&&t.env.NODE_DEBUG&&/\bsemver\b/i.test(t.env.NODE_DEBUG)?function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("SEMVER"),console.log.apply(console,e)}:function(){},r.SEMVER_SPEC_VERSION="2.0.0";var F=256,Y=Number.MAX_SAFE_INTEGER||9007199254740991,J=r.re=[],W=r.src=[],H=0,K=H++;W[K]="0|[1-9]\\d*";var Q=H++;W[Q]="[0-9]+";var ee=H++;W[ee]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var re=H++;W[re]="("+W[K]+")\\.("+W[K]+")\\.("+W[K]+")";var te=H++;W[te]="("+W[Q]+")\\.("+W[Q]+")\\.("+W[Q]+")";var ne=H++;W[ne]="(?:"+W[K]+"|"+W[ee]+")";var ie=H++;W[ie]="(?:"+W[Q]+"|"+W[ee]+")";var oe=H++;W[oe]="(?:-("+W[ne]+"(?:\\."+W[ne]+")*))";var se=H++;W[se]="(?:-?("+W[ie]+"(?:\\."+W[ie]+")*))";var ae=H++;W[ae]="[0-9A-Za-z-]+";var ue=H++;W[ue]="(?:\\+("+W[ae]+"(?:\\."+W[ae]+")*))";var ce=H++,pe="v?"+W[re]+W[oe]+"?"+W[ue]+"?";W[ce]="^"+pe+"$";var fe="[v=\\s]*"+W[te]+W[se]+"?"+W[ue]+"?",le=H++;W[le]="^"+fe+"$";var he=H++;W[he]="((?:<|>)?=?)";var ve=H++;W[ve]=W[Q]+"|x|X|\\*";var me=H++;W[me]=W[K]+"|x|X|\\*";var de=H++;W[de]="[v=\\s]*("+W[me]+")(?:\\.("+W[me]+")(?:\\.("+W[me]+")(?:"+W[oe]+")?"+W[ue]+"?)?)?";var ge=H++;W[ge]="[v=\\s]*("+W[ve]+")(?:\\.("+W[ve]+")(?:\\.("+W[ve]+")(?:"+W[se]+")?"+W[ue]+"?)?)?";var we=H++;W[we]="^"+W[he]+"\\s*"+W[de]+"$";var ye=H++;W[ye]="^"+W[he]+"\\s*"+W[ge]+"$";var be=H++;W[be]="(?:~>?)";var Ee=H++;W[Ee]="(\\s*)"+W[be]+"\\s+",J[Ee]=new RegExp(W[Ee],"g");var je="$1~",xe=H++;W[xe]="^"+W[be]+W[de]+"$";var ke=H++;W[ke]="^"+W[be]+W[ge]+"$";var $e=H++;W[$e]="(?:\\^)";var _e=H++;W[_e]="(\\s*)"+W[$e]+"\\s+",J[_e]=new RegExp(W[_e],"g");var Ae="$1^",Se=H++;W[Se]="^"+W[$e]+W[de]+"$";var Te=H++;W[Te]="^"+W[$e]+W[ge]+"$";var Ie=H++;W[Ie]="^"+W[he]+"\\s*("+fe+")$|^$";var Me=H++;W[Me]="^"+W[he]+"\\s*("+pe+")$|^$";var Re=H++;W[Re]="(\\s*)"+W[he]+"\\s*("+fe+"|"+W[de]+")",J[Re]=new RegExp(W[Re],"g");var Le="$1$2$3",Ne=H++;W[Ne]="^\\s*("+W[de]+")\\s+-\\s+("+W[de]+")\\s*$";var Ve=H++;W[Ve]="^\\s*("+W[ge]+")\\s+-\\s+("+W[ge]+")\\s*$";var Oe=H++;W[Oe]="(<|>)?=?\\s*\\*";for(var Ce=0;H>Ce;Ce++)q(Ce,W[Ce]),J[Ce]||(J[Ce]=new RegExp(W[Ce]));r.parse=n,r.valid=i,r.clean=o,r.SemVer=s,s.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version},s.prototype.toString=function(){return this.version},s.prototype.compare=function(e){return q("SemVer.compare",this.version,this.loose,e),e instanceof s||(e=new s(e,this.loose)),this.compareMain(e)||this.comparePre(e)},s.prototype.compareMain=function(e){return e instanceof s||(e=new s(e,this.loose)),c(this.major,e.major)||c(this.minor,e.minor)||c(this.patch,e.patch)},s.prototype.comparePre=function(e){if(e instanceof s||(e=new s(e,this.loose)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;var r=0;do{var t=this.prerelease[r],n=e.prerelease[r];if(q("prerelease compare",r,t,n),void 0===t&&void 0===n)return 0;if(void 0===n)return 1;if(void 0===t)return-1;if(t!==n)return c(t,n)}while(++r)},s.prototype.inc=function(e,r){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r),this.inc("pre",r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",r),this.inc("pre",r);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{for(var t=this.prerelease.length;--t>=0;)"number"==typeof this.prerelease[t]&&(this.prerelease[t]++,t=-2);-1===t&&this.prerelease.push(0)}r&&(this.prerelease[0]===r?isNaN(this.prerelease[1])&&(this.prerelease=[r,0]):this.prerelease=[r,0]);break;default:throw new Error("invalid increment argument: "+e)}return this.format(),this.raw=this.version,this},r.inc=a,r.diff=u,r.compareIdentifiers=c;var Pe=/^[0-9]+$/;r.rcompareIdentifiers=p,r.major=f,r.minor=l,r.patch=h,r.compare=v,r.compareLoose=m,r.rcompare=d,r.sort=g,r.rsort=w,r.gt=y,r.lt=b,r.eq=E,r.neq=j,r.gte=x,r.lte=k,r.cmp=$,r.Comparator=_;var Ue={};_.prototype.parse=function(e){var r=this.loose?J[Ie]:J[Me],t=e.match(r);if(!t)throw new TypeError("Invalid comparator: "+e);this.operator=t[1],"="===this.operator&&(this.operator=""),t[2]?this.semver=new s(t[2],this.loose):this.semver=Ue},_.prototype.toString=function(){return this.value},_.prototype.test=function(e){return q("Comparator.test",e,this.loose),this.semver===Ue?!0:("string"==typeof e&&(e=new s(e,this.loose)),$(e,this.operator,this.semver,this.loose))},r.Range=A,A.prototype.format=function(){return this.range=this.set.map(function(e){return e.join(" ").trim()}).join("||").trim(),this.range},A.prototype.toString=function(){return this.range},A.prototype.parseRange=function(e){var r=this.loose;e=e.trim(),q("range",e,r);var t=r?J[Ve]:J[Ne];e=e.replace(t,P),q("hyphen replace",e),e=e.replace(J[Re],Le),q("comparator trim",e,J[Re]),e=e.replace(J[Ee],je),e=e.replace(J[_e],Ae),e=e.split(/\s+/).join(" ");var n=r?J[Ie]:J[Me],i=e.split(" ").map(function(e){return T(e,r)}).join(" ").split(/\s+/);return this.loose&&(i=i.filter(function(e){return!!e.match(n)})),i=i.map(function(e){return new _(e,r)})},r.toComparators=S,A.prototype.test=function(e){if(!e)return!1;"string"==typeof e&&(e=new s(e,this.loose));for(var r=0;r<this.set.length;r++)if(U(this.set[r],e))return!0;return!1},r.satisfies=X,r.maxSatisfying=D,r.validRange=z,r.ltr=B,r.gtr=G,r.outside=Z}).call(r,t(2))},function(e,r,t){(function(r){"use strict";var n=t(1),i=t(7),o={"10.0":"10",6.3:"8.1",6.2:"8",6.1:"7","6.0":"Vista",5.1:"XP","5.0":"2000",4.9:"ME",4.1:"98","4.0":"95"};e.exports=function(e){var s=/\d+\.\d+/,a=s.exec(e||n.release());if(!e&&"win32"===r.platform&&i.satisfies(r.version,">=0.12.0 <3.1.0"))try{a=s.exec(String(t(!function(){var e=new Error('Cannot find module "child_process"');throw e.code="MODULE_NOT_FOUND",e}()).execSync("ver.exe",{timeout:2e3})))}catch(u){}if(e&&!a)throw new Error("`release` argument doesn't match `n.n`");return o[(a||[])[0]]}}).call(r,t(2))}])}); | ||
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.IsomophicUserAgent=r():e.IsomophicUserAgent=r()}(this,function(){return function(e){function r(n){if(t[n])return t[n].exports;var i=t[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}var t={};return r.m=e,r.c=t,r.p="",r(0)}([function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=t(3),o=n(i);r.default=o.default},function(e,r){r.endianness=function(){return"LE"},r.hostname=function(){return"undefined"!=typeof location?location.hostname:""},r.loadavg=function(){return[]},r.uptime=function(){return 0},r.freemem=function(){return Number.MAX_VALUE},r.totalmem=function(){return Number.MAX_VALUE},r.cpus=function(){return[]},r.type=function(){return"Browser"},r.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},r.networkInterfaces=r.getNetworkInterfaces=function(){return{}},r.arch=function(){return"javascript"},r.platform=function(){return"browser"},r.tmpdir=r.tmpDir=function(){return"/tmp"},r.EOL="\n"},function(e,r){function t(){p&&c&&(p=!1,c.length?f=c.concat(f):l=-1,f.length&&n())}function n(){if(!p){var e=s(t);p=!0;for(var r=f.length;r;){for(c=f,f=[];++l<r;)c&&c[l].run();l=-1,r=f.length}c=null,p=!1,a(e)}}function i(e,r){this.fun=e,this.array=r}function o(){}var s,a,u=e.exports={};!function(){try{s=setTimeout}catch(e){s=function(){throw new Error("setTimeout is not defined")}}try{a=clearTimeout}catch(e){a=function(){throw new Error("clearTimeout is not defined")}}}();var c,f=[],p=!1,l=-1;u.nextTick=function(e){var r=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)r[t-1]=arguments[t];f.push(new i(e,r)),1!==f.length||p||s(n,0)},i.prototype.run=function(){this.fun.apply(null,this.array)},u.title="browser",u.browser=!0,u.env={},u.argv=[],u.version="",u.versions={},u.on=o,u.addListener=o,u.once=o,u.off=o,u.removeListener=o,u.removeAllListeners=o,u.emit=o,u.binding=function(e){throw new Error("process.binding is not supported")},u.cwd=function(){return"/"},u.chdir=function(e){throw new Error("process.chdir is not supported")},u.umask=function(){return 0}},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0}),r.browserUserAgent=void 0;var i=t(4),o=n(i),s=function(e){return"undefined"!=typeof e&&null!==e&&e.navigator&&e.navigator.userAgent?e.navigator.userAgent:null};r.browserUserAgent=s,r.default=function(e){var r=e.browserUserAgent,t=void 0===r?s:r;return t()||(0,o.default)()}},function(e,r,t){(function(r){"use strict";var n=t(5),i="Node.js/"+r.version.slice(1)+" ("+n()+"; "+r.arch+")";e.exports=function(e,r){return 2!==arguments.length?i:e+"/"+r+" "+i}}).call(r,t(2))},function(e,r,t){"use strict";var n=t(1),i=t(6),o=t(8);e.exports=function(e,r){if(!e&&r)throw new Error("You can't specify a `release` without specfying `platform`");e=e||n.platform(),r=r||n.release();var t;return"darwin"===e?(t=i(r).name,"OS X"+(t?" "+t:"")):"linux"===e?(t=r.replace(/^(\d+\.\d+).*/,"$1"),"Linux"+(t?" "+t:"")):"win32"===e?(t=o(r),"Windows"+(t?" "+t:"")):e}},function(e,r,t){"use strict";var n=t(1),i={15:"El Capitan",14:"Yosemite",13:"Mavericks",12:"Mountain Lion",11:"Lion",10:"Snow Leopard",9:"Leopard",8:"Tiger",7:"Panther",6:"Jaguar",5:"Puma"};e.exports=function(e){return e=(e||n.release()).split(".")[0],{name:i[e],version:"10."+(Number(e)-4)}}},function(e,r,t){(function(t){function n(e,r){if(e instanceof s)return e;if("string"!=typeof e)return null;if(e.length>Y)return null;var t=r?W[he]:W[fe];if(!t.test(e))return null;try{return new s(e,r)}catch(n){return null}}function i(e,r){var t=n(e,r);return t?t.version:null}function o(e,r){var t=n(e.trim().replace(/^[=v]+/,""),r);return t?t.version:null}function s(e,r){if(e instanceof s){if(e.loose===r)return e;e=e.version}else if("string"!=typeof e)throw new TypeError("Invalid Version: "+e);if(e.length>Y)throw new TypeError("version is longer than "+Y+" characters");if(!(this instanceof s))return new s(e,r);F("SemVer",e,r),this.loose=r;var t=e.trim().match(r?W[he]:W[fe]);if(!t)throw new TypeError("Invalid Version: "+e);if(this.raw=e,this.major=+t[1],this.minor=+t[2],this.patch=+t[3],this.major>J||this.major<0)throw new TypeError("Invalid major version");if(this.minor>J||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>J||this.patch<0)throw new TypeError("Invalid patch version");t[4]?this.prerelease=t[4].split(".").map(function(e){if(/^[0-9]+$/.test(e)){var r=+e;if(r>=0&&r<J)return r}return e}):this.prerelease=[],this.build=t[5]?t[5].split("."):[],this.format()}function a(e,r,t,n){"string"==typeof t&&(n=t,t=void 0);try{return new s(e,t).inc(r,n).version}catch(i){return null}}function u(e,r){if(E(e,r))return null;var t=n(e),i=n(r);if(t.prerelease.length||i.prerelease.length){for(var o in t)if(("major"===o||"minor"===o||"patch"===o)&&t[o]!==i[o])return"pre"+o;return"prerelease"}for(var o in t)if(("major"===o||"minor"===o||"patch"===o)&&t[o]!==i[o])return o}function c(e,r){var t=Pe.test(e),n=Pe.test(r);return t&&n&&(e=+e,r=+r),t&&!n?-1:n&&!t?1:e<r?-1:e>r?1:0}function f(e,r){return c(r,e)}function p(e,r){return new s(e,r).major}function l(e,r){return new s(e,r).minor}function h(e,r){return new s(e,r).patch}function v(e,r,t){return new s(e,t).compare(r)}function m(e,r){return v(e,r,!0)}function g(e,r,t){return v(r,e,t)}function d(e,t){return e.sort(function(e,n){return r.compare(e,n,t)})}function w(e,t){return e.sort(function(e,n){return r.rcompare(e,n,t)})}function y(e,r,t){return v(e,r,t)>0}function b(e,r,t){return v(e,r,t)<0}function E(e,r,t){return 0===v(e,r,t)}function j(e,r,t){return 0!==v(e,r,t)}function x(e,r,t){return v(e,r,t)>=0}function k(e,r,t){return v(e,r,t)<=0}function $(e,r,t,n){var i;switch(r){case"===":"object"==typeof e&&(e=e.version),"object"==typeof t&&(t=t.version),i=e===t;break;case"!==":"object"==typeof e&&(e=e.version),"object"==typeof t&&(t=t.version),i=e!==t;break;case"":case"=":case"==":i=E(e,t,n);break;case"!=":i=j(e,t,n);break;case">":i=y(e,t,n);break;case">=":i=x(e,t,n);break;case"<":i=b(e,t,n);break;case"<=":i=k(e,t,n);break;default:throw new TypeError("Invalid operator: "+r)}return i}function A(e,r){if(e instanceof A){if(e.loose===r)return e;e=e.value}return this instanceof A?(F("comparator",e,r),this.loose=r,this.parse(e),this.semver===Xe?this.value="":this.value=this.operator+this.semver.version,void F("comp",this)):new A(e,r)}function T(e,r){if(e instanceof T&&e.loose===r)return e;if(!(this instanceof T))return new T(e,r);if(this.loose=r,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map(function(e){return this.parseRange(e.trim())},this).filter(function(e){return e.length}),!this.set.length)throw new TypeError("Invalid SemVer Range: "+e);this.format()}function _(e,r){return new T(e,r).set.map(function(e){return e.map(function(e){return e.value}).join(" ").trim().split(" ")})}function S(e,r){return F("comp",e),e=L(e,r),F("caret",e),e=M(e,r),F("tildes",e),e=V(e,r),F("xrange",e),e=O(e,r),F("stars",e),e}function I(e){return!e||"x"===e.toLowerCase()||"*"===e}function M(e,r){return e.trim().split(/\s+/).map(function(e){return R(e,r)}).join(" ")}function R(e,r){var t=r?W[$e]:W[ke];return e.replace(t,function(r,t,n,i,o){F("tilde",e,r,t,n,i,o);var s;return I(t)?s="":I(n)?s=">="+t+".0.0 <"+(+t+1)+".0.0":I(i)?s=">="+t+"."+n+".0 <"+t+"."+(+n+1)+".0":o?(F("replaceTilde pr",o),"-"!==o.charAt(0)&&(o="-"+o),s=">="+t+"."+n+"."+i+o+" <"+t+"."+(+n+1)+".0"):s=">="+t+"."+n+"."+i+" <"+t+"."+(+n+1)+".0",F("tilde return",s),s})}function L(e,r){return e.trim().split(/\s+/).map(function(e){return N(e,r)}).join(" ")}function N(e,r){F("caret",e,r);var t=r?W[Ie]:W[Se];return e.replace(t,function(r,t,n,i,o){F("caret",e,r,t,n,i,o);var s;return I(t)?s="":I(n)?s=">="+t+".0.0 <"+(+t+1)+".0.0":I(i)?s="0"===t?">="+t+"."+n+".0 <"+t+"."+(+n+1)+".0":">="+t+"."+n+".0 <"+(+t+1)+".0.0":o?(F("replaceCaret pr",o),"-"!==o.charAt(0)&&(o="-"+o),s="0"===t?"0"===n?">="+t+"."+n+"."+i+o+" <"+t+"."+n+"."+(+i+1):">="+t+"."+n+"."+i+o+" <"+t+"."+(+n+1)+".0":">="+t+"."+n+"."+i+o+" <"+(+t+1)+".0.0"):(F("no pr"),s="0"===t?"0"===n?">="+t+"."+n+"."+i+" <"+t+"."+n+"."+(+i+1):">="+t+"."+n+"."+i+" <"+t+"."+(+n+1)+".0":">="+t+"."+n+"."+i+" <"+(+t+1)+".0.0"),F("caret return",s),s})}function V(e,r){return F("replaceXRanges",e,r),e.split(/\s+/).map(function(e){return U(e,r)}).join(" ")}function U(e,r){e=e.trim();var t=r?W[be]:W[ye];return e.replace(t,function(r,t,n,i,o,s){F("xRange",e,r,t,n,i,o,s);var a=I(n),u=a||I(i),c=u||I(o),f=c;return"="===t&&f&&(t=""),a?r=">"===t||"<"===t?"<0.0.0":"*":t&&f?(u&&(i=0),c&&(o=0),">"===t?(t=">=",u?(n=+n+1,i=0,o=0):c&&(i=+i+1,o=0)):"<="===t&&(t="<",u?n=+n+1:i=+i+1),r=t+n+"."+i+"."+o):u?r=">="+n+".0.0 <"+(+n+1)+".0.0":c&&(r=">="+n+"."+i+".0 <"+n+"."+(+i+1)+".0"),F("xRange return",r),r})}function O(e,r){return F("replaceStars",e,r),e.trim().replace(W[Oe],"")}function C(e,r,t,n,i,o,s,a,u,c,f,p,l){return r=I(t)?"":I(n)?">="+t+".0.0":I(i)?">="+t+"."+n+".0":">="+r,a=I(u)?"":I(c)?"<"+(+u+1)+".0.0":I(f)?"<"+u+"."+(+c+1)+".0":p?"<="+u+"."+c+"."+f+"-"+p:"<="+a,(r+" "+a).trim()}function P(e,r){for(var t=0;t<e.length;t++)if(!e[t].test(r))return!1;if(r.prerelease.length){for(var t=0;t<e.length;t++)if(F(e[t].semver),e[t].semver!==Xe&&e[t].semver.prerelease.length>0){var n=e[t].semver;if(n.major===r.major&&n.minor===r.minor&&n.patch===r.patch)return!0}return!1}return!0}function X(e,r,t){try{r=new T(r,t)}catch(n){return!1}return r.test(e)}function D(e,r,t){return e.filter(function(e){return X(e,r,t)}).sort(function(e,r){return g(e,r,t)})[0]||null}function z(e,r){try{return new T(e,r).range||"*"}catch(t){return null}}function B(e,r,t){return Z(e,r,"<",t)}function G(e,r,t){return Z(e,r,">",t)}function Z(e,r,t,n){e=new s(e,n),r=new T(r,n);var i,o,a,u,c;switch(t){case">":i=y,o=k,a=b,u=">",c=">=";break;case"<":i=b,o=x,a=y,u="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(X(e,r,n))return!1;for(var f=0;f<r.set.length;++f){var p=r.set[f],l=null,h=null;if(p.forEach(function(e){e.semver===Xe&&(e=new A(">=0.0.0")),l=l||e,h=h||e,i(e.semver,l.semver,n)?l=e:a(e.semver,h.semver,n)&&(h=e)}),l.operator===u||l.operator===c)return!1;if((!h.operator||h.operator===u)&&o(e,h.semver))return!1;if(h.operator===c&&a(e,h.semver))return!1}return!0}function q(e,r){var t=n(e,r);return t&&t.prerelease.length?t.prerelease:null}r=e.exports=s;var F;F="object"==typeof t&&t.env&&t.env.NODE_DEBUG&&/\bsemver\b/i.test(t.env.NODE_DEBUG)?function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("SEMVER"),console.log.apply(console,e)}:function(){},r.SEMVER_SPEC_VERSION="2.0.0";var Y=256,J=Number.MAX_SAFE_INTEGER||9007199254740991,W=r.re=[],H=r.src=[],K=0,Q=K++;H[Q]="0|[1-9]\\d*";var ee=K++;H[ee]="[0-9]+";var re=K++;H[re]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var te=K++;H[te]="("+H[Q]+")\\.("+H[Q]+")\\.("+H[Q]+")";var ne=K++;H[ne]="("+H[ee]+")\\.("+H[ee]+")\\.("+H[ee]+")";var ie=K++;H[ie]="(?:"+H[Q]+"|"+H[re]+")";var oe=K++;H[oe]="(?:"+H[ee]+"|"+H[re]+")";var se=K++;H[se]="(?:-("+H[ie]+"(?:\\."+H[ie]+")*))";var ae=K++;H[ae]="(?:-?("+H[oe]+"(?:\\."+H[oe]+")*))";var ue=K++;H[ue]="[0-9A-Za-z-]+";var ce=K++;H[ce]="(?:\\+("+H[ue]+"(?:\\."+H[ue]+")*))";var fe=K++,pe="v?"+H[te]+H[se]+"?"+H[ce]+"?";H[fe]="^"+pe+"$";var le="[v=\\s]*"+H[ne]+H[ae]+"?"+H[ce]+"?",he=K++;H[he]="^"+le+"$";var ve=K++;H[ve]="((?:<|>)?=?)";var me=K++;H[me]=H[ee]+"|x|X|\\*";var ge=K++;H[ge]=H[Q]+"|x|X|\\*";var de=K++;H[de]="[v=\\s]*("+H[ge]+")(?:\\.("+H[ge]+")(?:\\.("+H[ge]+")(?:"+H[se]+")?"+H[ce]+"?)?)?";var we=K++;H[we]="[v=\\s]*("+H[me]+")(?:\\.("+H[me]+")(?:\\.("+H[me]+")(?:"+H[ae]+")?"+H[ce]+"?)?)?";var ye=K++;H[ye]="^"+H[ve]+"\\s*"+H[de]+"$";var be=K++;H[be]="^"+H[ve]+"\\s*"+H[we]+"$";var Ee=K++;H[Ee]="(?:~>?)";var je=K++;H[je]="(\\s*)"+H[Ee]+"\\s+",W[je]=new RegExp(H[je],"g");var xe="$1~",ke=K++;H[ke]="^"+H[Ee]+H[de]+"$";var $e=K++;H[$e]="^"+H[Ee]+H[we]+"$";var Ae=K++;H[Ae]="(?:\\^)";var Te=K++;H[Te]="(\\s*)"+H[Ae]+"\\s+",W[Te]=new RegExp(H[Te],"g");var _e="$1^",Se=K++;H[Se]="^"+H[Ae]+H[de]+"$";var Ie=K++;H[Ie]="^"+H[Ae]+H[we]+"$";var Me=K++;H[Me]="^"+H[ve]+"\\s*("+le+")$|^$";var Re=K++;H[Re]="^"+H[ve]+"\\s*("+pe+")$|^$";var Le=K++;H[Le]="(\\s*)"+H[ve]+"\\s*("+le+"|"+H[de]+")",W[Le]=new RegExp(H[Le],"g");var Ne="$1$2$3",Ve=K++;H[Ve]="^\\s*("+H[de]+")\\s+-\\s+("+H[de]+")\\s*$";var Ue=K++;H[Ue]="^\\s*("+H[we]+")\\s+-\\s+("+H[we]+")\\s*$";var Oe=K++;H[Oe]="(<|>)?=?\\s*\\*";for(var Ce=0;Ce<K;Ce++)F(Ce,H[Ce]),W[Ce]||(W[Ce]=new RegExp(H[Ce]));r.parse=n,r.valid=i,r.clean=o,r.SemVer=s,s.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version},s.prototype.toString=function(){return this.version},s.prototype.compare=function(e){return F("SemVer.compare",this.version,this.loose,e),e instanceof s||(e=new s(e,this.loose)),this.compareMain(e)||this.comparePre(e)},s.prototype.compareMain=function(e){return e instanceof s||(e=new s(e,this.loose)),c(this.major,e.major)||c(this.minor,e.minor)||c(this.patch,e.patch)},s.prototype.comparePre=function(e){if(e instanceof s||(e=new s(e,this.loose)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;var r=0;do{var t=this.prerelease[r],n=e.prerelease[r];if(F("prerelease compare",r,t,n),void 0===t&&void 0===n)return 0;if(void 0===n)return 1;if(void 0===t)return-1;if(t!==n)return c(t,n)}while(++r)},s.prototype.inc=function(e,r){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r),this.inc("pre",r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",r),this.inc("pre",r);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{for(var t=this.prerelease.length;--t>=0;)"number"==typeof this.prerelease[t]&&(this.prerelease[t]++,t=-2);t===-1&&this.prerelease.push(0)}r&&(this.prerelease[0]===r?isNaN(this.prerelease[1])&&(this.prerelease=[r,0]):this.prerelease=[r,0]);break;default:throw new Error("invalid increment argument: "+e)}return this.format(),this.raw=this.version,this},r.inc=a,r.diff=u,r.compareIdentifiers=c;var Pe=/^[0-9]+$/;r.rcompareIdentifiers=f,r.major=p,r.minor=l,r.patch=h,r.compare=v,r.compareLoose=m,r.rcompare=g,r.sort=d,r.rsort=w,r.gt=y,r.lt=b,r.eq=E,r.neq=j,r.gte=x,r.lte=k,r.cmp=$,r.Comparator=A;var Xe={};A.prototype.parse=function(e){var r=this.loose?W[Me]:W[Re],t=e.match(r);if(!t)throw new TypeError("Invalid comparator: "+e);this.operator=t[1],"="===this.operator&&(this.operator=""),t[2]?this.semver=new s(t[2],this.loose):this.semver=Xe},A.prototype.toString=function(){return this.value},A.prototype.test=function(e){return F("Comparator.test",e,this.loose),this.semver===Xe||("string"==typeof e&&(e=new s(e,this.loose)),$(e,this.operator,this.semver,this.loose))},r.Range=T,T.prototype.format=function(){return this.range=this.set.map(function(e){return e.join(" ").trim()}).join("||").trim(),this.range},T.prototype.toString=function(){return this.range},T.prototype.parseRange=function(e){var r=this.loose;e=e.trim(),F("range",e,r);var t=r?W[Ue]:W[Ve];e=e.replace(t,C),F("hyphen replace",e),e=e.replace(W[Le],Ne),F("comparator trim",e,W[Le]),e=e.replace(W[je],xe),e=e.replace(W[Te],_e),e=e.split(/\s+/).join(" ");var n=r?W[Me]:W[Re],i=e.split(" ").map(function(e){return S(e,r)}).join(" ").split(/\s+/);return this.loose&&(i=i.filter(function(e){return!!e.match(n)})),i=i.map(function(e){return new A(e,r)})},r.toComparators=_,T.prototype.test=function(e){if(!e)return!1;"string"==typeof e&&(e=new s(e,this.loose));for(var r=0;r<this.set.length;r++)if(P(this.set[r],e))return!0;return!1},r.satisfies=X,r.maxSatisfying=D,r.validRange=z,r.ltr=B,r.gtr=G,r.outside=Z,r.prerelease=q}).call(r,t(2))},function(e,r,t){(function(r){"use strict";var n=t(1),i=t(7),o={"10.0":"10",6.3:"8.1",6.2:"8",6.1:"7","6.0":"Vista",5.1:"XP","5.0":"2000",4.9:"ME",4.1:"98","4.0":"95"};e.exports=function(e){var s=/\d+\.\d+/,a=s.exec(e||n.release());if(!e&&"win32"===r.platform&&i.satisfies(r.version,">=0.12.0 <3.1.0"))try{a=s.exec(String(t(!function(){var e=new Error('Cannot find module "child_process"');throw e.code="MODULE_NOT_FOUND",e}()).execSync("ver.exe",{timeout:2e3})))}catch(u){}if(e&&!a)throw new Error("`release` argument doesn't match `n.n`");return o[(a||[])[0]]}}).call(r,t(2))}])}); |
{ | ||
"name": "isomorphic-user-agent", | ||
"version": "1.0.2", | ||
"version": "2.0.0", | ||
"description": "Isomorphic user agent", | ||
"main": "./dist/bundle.js", | ||
"main": "./dist/index.js", | ||
"scripts": { | ||
"test": "jest", | ||
"build": "webpack --config webpack.config.js", | ||
"prepublish": "npm run build" | ||
"clean": "rm -rf dist", | ||
"transpile": "babel src -D -d dist --ignore '__tests__'", | ||
"bundle": "webpack --config webpack.config.js", | ||
"build": "npm run lint && npm run clean && npm run transpile && npm run bundle", | ||
"lint": "eslint ./src" | ||
}, | ||
@@ -33,7 +36,13 @@ "repository": { | ||
"babel-core": "^6.7.7", | ||
"babel-jest": "^11.0.2", | ||
"babel-eslint": "^6.0.4", | ||
"babel-jest": "^13.0.0", | ||
"babel-loader": "^6.2.4", | ||
"babel-preset-es2015": "^6.6.0", | ||
"babel-preset-stage-0": "^6.5.0", | ||
"jest-cli": "^11.0.2", | ||
"eslint": "^2.9.0", | ||
"eslint-config-airbnb": "^9.0.1", | ||
"eslint-plugin-import": "^1.7.0", | ||
"eslint-plugin-jsx-a11y": "^1.2.0", | ||
"eslint-plugin-react": "^5.2.2", | ||
"jest-cli": "^13.0.0", | ||
"webpack": "^1.13.0" | ||
@@ -43,3 +52,34 @@ }, | ||
"default-user-agent": "^1.0.0" | ||
}, | ||
"babel": { | ||
"presets": [ | ||
"es2015", | ||
"stage-0" | ||
] | ||
}, | ||
"eslintConfig": { | ||
"extends": "airbnb", | ||
"env": { | ||
"browser": true, | ||
"node": true, | ||
"jasmine": true, | ||
"jest": true | ||
}, | ||
"parser": "babel-eslint", | ||
"rules": { | ||
"semi": 0, | ||
"new-cap": 0, | ||
"no-underscore-dangle": 0, | ||
"no-console": [ | ||
2, | ||
{ | ||
"allow": [ | ||
"warn", | ||
"error", | ||
"info" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} |
# isomorphic-user-agent | ||
[![npm version](https://img.shields.io/npm/v/isomorphic-user-agent.svg?style=flat-square)](https://www.npmjs.com/package/isomorphic-user-agent) | ||
[![dependency status](https://img.shields.io/david/team-magneto/isomorphic-user-agent.svg?style=flat-square)](https://david-dm.org/team-magneto/isomorphic-user-agent) | ||
[![build status](https://img.shields.io/travis/team-magneto/isomorphic-user-agent.svg?style=flat-square)](https://travis-ci.org/team-magneto/isomorphic-user-agent) | ||
@@ -3,0 +6,0 @@ Returns user agent in browser/node |
@@ -8,15 +8,27 @@ jest.unmock('../isomorphic-user-agent') | ||
describe('IsomophicUserAgent', () => { | ||
let fakeBrowserUserAgent | ||
describe('when browser', () => { | ||
let iphoneUserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1" | ||
const iphoneUserAgent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X)' | ||
beforeEach(() => { window.navigator = { userAgent: iphoneUserAgent } }) | ||
beforeEach(() => { | ||
fakeBrowserUserAgent = () => iphoneUserAgent | ||
}) | ||
it('returns browser user agent', () => { expect(IsomophicUserAgent()).toBe(iphoneUserAgent) }) | ||
it('returns browser user agent', () => { | ||
expect(IsomophicUserAgent({ browserUserAgent: fakeBrowserUserAgent })).toBe(iphoneUserAgent) | ||
}) | ||
}) | ||
describe('when nodejs', () => { | ||
beforeEach(() => { window.navigator = undefined }) | ||
beforeEach(() => { | ||
fakeBrowserUserAgent = () => null | ||
}) | ||
it('returns default-user-agent', () => { expect(IsomophicUserAgent()).toBe(DefaultUserAgent()) }) | ||
it('returns default-user-agent', () => { | ||
expect( | ||
IsomophicUserAgent({ browserUserAgent: fakeBrowserUserAgent }) | ||
).toBe(DefaultUserAgent()) | ||
}) | ||
}) | ||
}) |
@@ -1,9 +0,17 @@ | ||
import DefaultUserAgent from 'default-user-agent' | ||
import defaultUserAgent from 'default-user-agent' | ||
export default () => { | ||
if (typeof window !== 'undefined' && window !== null && window.navigator && window.navigator.userAgent) { | ||
return window.navigator.userAgent | ||
} else { | ||
return DefaultUserAgent() | ||
const defaultBrowserUserAgent = (_window) => { | ||
if ( | ||
typeof _window !== 'undefined' && | ||
_window !== null && | ||
_window.navigator && | ||
_window.navigator.userAgent | ||
) { | ||
return _window.navigator.userAgent | ||
} | ||
return null | ||
} | ||
export { defaultBrowserUserAgent as browserUserAgent } | ||
export default ({ browserUserAgent = defaultBrowserUserAgent }) => | ||
browserUserAgent() || defaultUserAgent() |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
24514
11
103
17
14