@commercetools/http-user-agent
Advanced tools
Comparing version 1.1.9 to 1.1.10
@@ -15,3 +15,2 @@ 'use strict'; | ||
*/ | ||
var isBrowser = function isBrowser() { | ||
@@ -23,25 +22,19 @@ return typeof window !== 'undefined' && window.document && window.document.nodeType === 9; | ||
if (isBrowser()) return window.navigator.userAgent; | ||
var nodeVersion = process.version.slice(1); | ||
var platformInfo = '(' + process.platform + '; ' + process.arch + ')'; | ||
return 'Node.js/' + nodeVersion + ' ' + platformInfo; | ||
var platformInfo = "(".concat(process.platform, "; ").concat(process.arch, ")"); | ||
return "Node.js/".concat(nodeVersion, " ").concat(platformInfo); | ||
} | ||
function createUserAgent(options) { | ||
if (!options || Object.keys(options).length === 0 || !{}.hasOwnProperty.call(options, 'name')) throw new Error('Missing required option `name`'); | ||
if (!options || Object.keys(options).length === 0 || !{}.hasOwnProperty.call(options, 'name')) throw new Error('Missing required option `name`'); // Main info | ||
// Main info | ||
var baseInfo = options.version ? options.name + '/' + options.version : options.name; | ||
var baseInfo = options.version ? "".concat(options.name, "/").concat(options.version) : options.name; // Library info | ||
// Library info | ||
var libraryInfo = void 0; | ||
if (options.libraryName && !options.libraryVersion) libraryInfo = options.libraryName;else if (options.libraryName && options.libraryVersion) libraryInfo = options.libraryName + '/' + options.libraryVersion; | ||
var libraryInfo; | ||
if (options.libraryName && !options.libraryVersion) libraryInfo = options.libraryName;else if (options.libraryName && options.libraryVersion) libraryInfo = "".concat(options.libraryName, "/").concat(options.libraryVersion); // Contact info | ||
// Contact info | ||
var contactInfo = void 0; | ||
if (options.contactUrl && !options.contactEmail) contactInfo = '(+' + options.contactUrl + ')';else if (!options.contactUrl && options.contactEmail) contactInfo = '(+' + options.contactEmail + ')';else if (options.contactUrl && options.contactEmail) contactInfo = '(+' + options.contactUrl + '; +' + options.contactEmail + ')'; | ||
var contactInfo; | ||
if (options.contactUrl && !options.contactEmail) contactInfo = "(+".concat(options.contactUrl, ")");else if (!options.contactUrl && options.contactEmail) contactInfo = "(+".concat(options.contactEmail, ")");else if (options.contactUrl && options.contactEmail) contactInfo = "(+".concat(options.contactUrl, "; +").concat(options.contactEmail, ")"); // System info | ||
// System info | ||
var systemInfo = getSystemInfo(); | ||
return [baseInfo, systemInfo, libraryInfo, contactInfo].filter(function (x) { | ||
@@ -48,0 +41,0 @@ return Boolean(x); |
@@ -13,3 +13,2 @@ /* */ | ||
*/ | ||
var isBrowser = function isBrowser() { | ||
@@ -21,25 +20,19 @@ return typeof window !== 'undefined' && window.document && window.document.nodeType === 9; | ||
if (isBrowser()) return window.navigator.userAgent; | ||
var nodeVersion = process.version.slice(1); | ||
var platformInfo = '(' + process.platform + '; ' + process.arch + ')'; | ||
return 'Node.js/' + nodeVersion + ' ' + platformInfo; | ||
var platformInfo = "(".concat(process.platform, "; ").concat(process.arch, ")"); | ||
return "Node.js/".concat(nodeVersion, " ").concat(platformInfo); | ||
} | ||
function createUserAgent(options) { | ||
if (!options || Object.keys(options).length === 0 || !{}.hasOwnProperty.call(options, 'name')) throw new Error('Missing required option `name`'); | ||
if (!options || Object.keys(options).length === 0 || !{}.hasOwnProperty.call(options, 'name')) throw new Error('Missing required option `name`'); // Main info | ||
// Main info | ||
var baseInfo = options.version ? options.name + '/' + options.version : options.name; | ||
var baseInfo = options.version ? "".concat(options.name, "/").concat(options.version) : options.name; // Library info | ||
// Library info | ||
var libraryInfo = void 0; | ||
if (options.libraryName && !options.libraryVersion) libraryInfo = options.libraryName;else if (options.libraryName && options.libraryVersion) libraryInfo = options.libraryName + '/' + options.libraryVersion; | ||
var libraryInfo; | ||
if (options.libraryName && !options.libraryVersion) libraryInfo = options.libraryName;else if (options.libraryName && options.libraryVersion) libraryInfo = "".concat(options.libraryName, "/").concat(options.libraryVersion); // Contact info | ||
// Contact info | ||
var contactInfo = void 0; | ||
if (options.contactUrl && !options.contactEmail) contactInfo = '(+' + options.contactUrl + ')';else if (!options.contactUrl && options.contactEmail) contactInfo = '(+' + options.contactEmail + ')';else if (options.contactUrl && options.contactEmail) contactInfo = '(+' + options.contactUrl + '; +' + options.contactEmail + ')'; | ||
var contactInfo; | ||
if (options.contactUrl && !options.contactEmail) contactInfo = "(+".concat(options.contactUrl, ")");else if (!options.contactUrl && options.contactEmail) contactInfo = "(+".concat(options.contactEmail, ")");else if (options.contactUrl && options.contactEmail) contactInfo = "(+".concat(options.contactUrl, "; +").concat(options.contactEmail, ")"); // System info | ||
// System info | ||
var systemInfo = getSystemInfo(); | ||
return [baseInfo, systemInfo, libraryInfo, contactInfo].filter(function (x) { | ||
@@ -46,0 +39,0 @@ return Boolean(x); |
@@ -19,3 +19,2 @@ (function (global, factory) { | ||
*/ | ||
var isBrowser = function isBrowser() { | ||
@@ -27,25 +26,19 @@ return typeof window !== 'undefined' && window.document && window.document.nodeType === 9; | ||
if (isBrowser()) return window.navigator.userAgent; | ||
var nodeVersion = process.version.slice(1); | ||
var platformInfo = '(' + process.platform + '; ' + process.arch + ')'; | ||
return 'Node.js/' + nodeVersion + ' ' + platformInfo; | ||
var platformInfo = "(".concat(process.platform, "; ").concat(process.arch, ")"); | ||
return "Node.js/".concat(nodeVersion, " ").concat(platformInfo); | ||
} | ||
function createUserAgent(options) { | ||
if (!options || Object.keys(options).length === 0 || !{}.hasOwnProperty.call(options, 'name')) throw new Error('Missing required option `name`'); | ||
if (!options || Object.keys(options).length === 0 || !{}.hasOwnProperty.call(options, 'name')) throw new Error('Missing required option `name`'); // Main info | ||
// Main info | ||
var baseInfo = options.version ? options.name + '/' + options.version : options.name; | ||
var baseInfo = options.version ? "".concat(options.name, "/").concat(options.version) : options.name; // Library info | ||
// Library info | ||
var libraryInfo = void 0; | ||
if (options.libraryName && !options.libraryVersion) libraryInfo = options.libraryName;else if (options.libraryName && options.libraryVersion) libraryInfo = options.libraryName + '/' + options.libraryVersion; | ||
var libraryInfo; | ||
if (options.libraryName && !options.libraryVersion) libraryInfo = options.libraryName;else if (options.libraryName && options.libraryVersion) libraryInfo = "".concat(options.libraryName, "/").concat(options.libraryVersion); // Contact info | ||
// Contact info | ||
var contactInfo = void 0; | ||
if (options.contactUrl && !options.contactEmail) contactInfo = '(+' + options.contactUrl + ')';else if (!options.contactUrl && options.contactEmail) contactInfo = '(+' + options.contactEmail + ')';else if (options.contactUrl && options.contactEmail) contactInfo = '(+' + options.contactUrl + '; +' + options.contactEmail + ')'; | ||
var contactInfo; | ||
if (options.contactUrl && !options.contactEmail) contactInfo = "(+".concat(options.contactUrl, ")");else if (!options.contactUrl && options.contactEmail) contactInfo = "(+".concat(options.contactEmail, ")");else if (options.contactUrl && options.contactEmail) contactInfo = "(+".concat(options.contactUrl, "; +").concat(options.contactEmail, ")"); // System info | ||
// System info | ||
var systemInfo = getSystemInfo(); | ||
return [baseInfo, systemInfo, libraryInfo, contactInfo].filter(function (x) { | ||
@@ -52,0 +45,0 @@ return Boolean(x); |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.CommercetoolsHttpUserAgent=n()}(this,function(){"use strict";var t=function(){return"undefined"!=typeof window&&window.document&&9===window.document.nodeType};return function(e){if(!e||0===Object.keys(e).length||!{}.hasOwnProperty.call(e,"name"))throw new Error("Missing required option `name`");var n=e.version?e.name+"/"+e.version:e.name,o=void 0;e.libraryName&&!e.libraryVersion?o=e.libraryName:e.libraryName&&e.libraryVersion&&(o=e.libraryName+"/"+e.libraryVersion);var r=void 0;return e.contactUrl&&!e.contactEmail?r="(+"+e.contactUrl+")":!e.contactUrl&&e.contactEmail?r="(+"+e.contactEmail+")":e.contactUrl&&e.contactEmail&&(r="(+"+e.contactUrl+"; +"+e.contactEmail+")"),[n,t()?window.navigator.userAgent:"Node.js/"+process.version.slice(1)+" ("+process.platform+"; "+process.arch+")",o,r].filter(function(e){return Boolean(e)}).join(" ")}}); | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):e.CommercetoolsHttpUserAgent=r()}(this,function(){"use strict";var e=require("./_global"),o=require("./_inherit-if-required"),t=require("./_object-dp").f,r=require("./_object-gopn").f,c=require("./_is-regexp"),a=require("./_flags"),s=e.RegExp,u=s,l=s.prototype,i=/a/g,n=/a/g,f=new s(i)!==i;if(require("./_descriptors")&&(!f||require("./_fails")(function(){return n[require("./_wks")("match")]=!1,s(i)!=i||s(n)==n||"/a/i"!=s(i,"i")}))){s=function(e,r){var t=this instanceof s,i=c(e),n=void 0===r;return!t&&i&&e.constructor===s&&n?e:o(f?new u(i&&!n?e.source:e,r):u((i=e instanceof s)?e.source:e,i&&n?a.call(e):r),t?this:l,s)};for(var d=function(r){r in s||t(s,r,{configurable:!0,get:function(){return u[r]},set:function(e){u[r]=e}})},p=r(u),m=0;p.length>m;)d(p[m++]);(l.constructor=s).prototype=l,require("./_redefine")(e,"RegExp",s)}require("./_set-species")("RegExp"),require("./_fix-re-wks")("match",1,function(i,n,e){return[function(e){var r=i(this),t=null==e?void 0:e[n];return void 0!==t?t.call(e,r):new RegExp(e)[n](String(r))},e]});var _=require("./_object-dp").f,y=Function.prototype,g=/^\s*function ([^ (]*)/,q="name";q in y||require("./_descriptors")&&_(y,q,{configurable:!0,get:function(){try{return(""+this).match(g)[1]}catch(e){return""}}});for(var h=require("./es6.array.iterator"),L=require("./_object-keys"),v=require("./_redefine"),b=require("./_global"),S=require("./_hide"),w=require("./_iterators"),T=require("./_wks"),k=T("iterator"),j=T("toStringTag"),E=w.Array,x={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},M=L(x),A=0;A<M.length;A++){var V,N=M[A],C=x[N],R=b[N],G=R&&R.prototype;if(G&&(G[k]||S(G,k,E),G[j]||S(G,j,N),w[N]=E,C))for(V in h)G[V]||v(G,V,h[V],!0)}var P=require("./_add-to-unscopables"),U=require("./_iter-step"),D=require("./_iterators"),H=require("./_to-iobject");module.exports=require("./_iter-define")(Array,"Array",function(e,r){this._t=H(e),this._i=0,this._k=r},function(){var e=this._t,r=this._k,t=this._i++;return!e||t>=e.length?(this._t=void 0,U(1)):U(0,"keys"==r?t:"values"==r?e[t]:[t,e[t]])},"values"),D.Arguments=D.Array,P("keys"),P("values"),P("entries");var O=require("./_to-object"),F=require("./_object-keys");require("./_object-sap")("keys",function(){return function(e){return F(O(e))}});var B=function(){return"undefined"!=typeof window&&window.document&&9===window.document.nodeType};return function(e){if(!e||0===Object.keys(e).length||!{}.hasOwnProperty.call(e,"name"))throw new Error("Missing required option `name`");var r,t,i=e.version?"".concat(e.name,"/").concat(e.version):e.name;return e.libraryName&&!e.libraryVersion?r=e.libraryName:e.libraryName&&e.libraryVersion&&(r="".concat(e.libraryName,"/").concat(e.libraryVersion)),e.contactUrl&&!e.contactEmail?t="(+".concat(e.contactUrl,")"):!e.contactUrl&&e.contactEmail?t="(+".concat(e.contactEmail,")"):e.contactUrl&&e.contactEmail&&(t="(+".concat(e.contactUrl,"; +").concat(e.contactEmail,")")),[i,function(){if(B())return window.navigator.userAgent;var e=process.version.slice(1),r="(".concat(process.platform,"; ").concat(process.arch,")");return"Node.js/".concat(e," ").concat(r)}(),r,t].filter(function(e){return Boolean(e)}).join(" ")}}); | ||
//# sourceMappingURL=commercetools-http-user-agent.umd.min.js.map |
@@ -7,3 +7,3 @@ { | ||
"name": "@commercetools/http-user-agent", | ||
"version": "1.1.9", | ||
"version": "1.1.10", | ||
"description": "Creates a proper HTTP User-Agent", | ||
@@ -36,3 +36,4 @@ "keywords": [ | ||
"build:cjs": "cross-env NODE_ENV=rollup rollup -c ../../rollup.config.js -f cjs -n CommercetoolsHttpUserAgent -i src/index.js -o dist/commercetools-http-user-agent.cjs.js" | ||
} | ||
}, | ||
"gitHead": "9ce98abfddac28acbd1dd6c223d06ea31315153a" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
13996
11
125
1