Comparing version 1.4.1 to 1.5.0
@@ -8,2 +8,5 @@ // reference gist https://gist.github.com/scottcorgan/a581668485381b39dfd0 | ||
}); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
exports['default'] = sdk; | ||
@@ -29,2 +32,16 @@ | ||
function configGlobalSpec(globalSpec) { | ||
var headers = undefined; | ||
if (typeof globalSpec.headers === 'function') { | ||
headers = globalSpec.headers(); | ||
} else { | ||
headers = globalSpec.headers; | ||
} | ||
return _extends({}, globalSpec, { | ||
headers: headers | ||
}); | ||
} | ||
function sdk() { | ||
@@ -40,3 +57,3 @@ var globalSpec = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
}; | ||
var configuredSpec = (0, _lodash.merge)(defaultSpec, globalSpec); | ||
var configuredSpec = (0, _lodash.merge)(defaultSpec, configGlobalSpec(globalSpec)); | ||
@@ -43,0 +60,0 @@ function apiFactory() { |
{ | ||
"name": "lw-sdk", | ||
"version": "1.4.1", | ||
"version": "1.5.0", | ||
"description": "SDK for Laurel & Wolf API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -11,2 +11,18 @@ // reference gist https://gist.github.com/scottcorgan/a581668485381b39dfd0 | ||
function configGlobalSpec (globalSpec) { | ||
let headers | ||
if (typeof globalSpec.headers === 'function') { | ||
headers = globalSpec.headers() | ||
} | ||
else { | ||
headers = globalSpec.headers | ||
} | ||
return { | ||
...globalSpec, | ||
headers | ||
} | ||
} | ||
export default function sdk (globalSpec = {}) { | ||
@@ -21,3 +37,3 @@ | ||
}; | ||
let configuredSpec = merge(defaultSpec, globalSpec); | ||
let configuredSpec = merge(defaultSpec, configGlobalSpec(globalSpec)); | ||
@@ -24,0 +40,0 @@ function apiFactory (instanceSpec = {}) { |
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
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
288366
7633
3