Socket
Socket
Sign inDemoInstall

@commercetools/http-user-agent

Package Overview
Dependencies
Maintainers
9
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commercetools/http-user-agent - npm Package Compare versions

Comparing version 1.1.6 to 1.1.7

78

dist/commercetools-http-user-agent.umd.js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.CommercetoolsHttpUserAgent = factory());
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.CommercetoolsHttpUserAgent = factory());
}(this, (function () { 'use strict';
/* */
/* */
/* global window */
/* global window */
/*
This is the easiest way, for this use case, to detect if we're running in
Node.js or in a browser environment. In other cases, this won't be even a
problem as Rollup will provide the correct polyfill in the bundle.
The main advantage by doing it this way is that it allows to easily test
the code running in both environments, by overriding `global.window` in
the specific test.
*/
/*
This is the easiest way, for this use case, to detect if we're running in
Node.js or in a browser environment. In other cases, this won't be even a
problem as Rollup will provide the correct polyfill in the bundle.
The main advantage by doing it this way is that it allows to easily test
the code running in both environments, by overriding `global.window` in
the specific test.
*/
var isBrowser = function isBrowser() {
return typeof window !== 'undefined' && window.document && window.document.nodeType === 9;
};
var isBrowser = function isBrowser() {
return typeof window !== 'undefined' && window.document && window.document.nodeType === 9;
};
function getSystemInfo() {
if (isBrowser()) return window.navigator.userAgent;
function getSystemInfo() {
if (isBrowser()) return window.navigator.userAgent;
var nodeVersion = process.version.slice(1);
var platformInfo = '(' + process.platform + '; ' + process.arch + ')';
return 'Node.js/' + nodeVersion + ' ' + platformInfo;
}
var nodeVersion = process.version.slice(1);
var platformInfo = '(' + process.platform + '; ' + process.arch + ')';
return 'Node.js/' + nodeVersion + ' ' + platformInfo;
}
function createUserAgent(options) {
if (!options || Object.keys(options).length === 0 || !{}.hasOwnProperty.call(options, 'name')) throw new Error('Missing required option `name`');
function createUserAgent(options) {
if (!options || Object.keys(options).length === 0 || !{}.hasOwnProperty.call(options, 'name')) throw new Error('Missing required option `name`');
// Main info
var baseInfo = options.version ? options.name + '/' + options.version : options.name;
// Main info
var baseInfo = options.version ? options.name + '/' + options.version : options.name;
// 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;
// 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;
// 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 + ')';
// 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 + ')';
// System info
var systemInfo = getSystemInfo();
// System info
var systemInfo = getSystemInfo();
return [baseInfo, systemInfo, libraryInfo, contactInfo].filter(function (x) {
return Boolean(x);
}).join(' ');
}
return [baseInfo, systemInfo, libraryInfo, contactInfo].filter(function (x) {
return Boolean(x);
}).join(' ');
}
return createUserAgent;
return createUserAgent;
})));
//# sourceMappingURL=commercetools-http-user-agent.umd.js.map

@@ -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 e=function(){return"undefined"!=typeof window&&window.document&&9===window.document.nodeType};return function(n){if(!n||0===Object.keys(n).length||!{}.hasOwnProperty.call(n,"name"))throw new Error("Missing required option `name`");var o=n.version?n.name+"/"+n.version:n.name,r=void 0;n.libraryName&&!n.libraryVersion?r=n.libraryName:n.libraryName&&n.libraryVersion&&(r=n.libraryName+"/"+n.libraryVersion);var t=void 0;return n.contactUrl&&!n.contactEmail?t="(+"+n.contactUrl+")":!n.contactUrl&&n.contactEmail?t="(+"+n.contactEmail+")":n.contactUrl&&n.contactEmail&&(t="(+"+n.contactUrl+"; +"+n.contactEmail+")"),[o,e()?window.navigator.userAgent:"Node.js/"+process.version.slice(1)+" ("+process.platform+"; "+process.arch+")",r,t].filter(function(e){return Boolean(e)}).join(" ")}});
!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(" ")}});
//# sourceMappingURL=commercetools-http-user-agent.umd.min.js.map

@@ -7,3 +7,3 @@ {

"name": "@commercetools/http-user-agent",
"version": "1.1.6",
"version": "1.1.7",
"description": "Creates a proper HTTP User-Agent",

@@ -10,0 +10,0 @@ "keywords": [

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