MCPcopy Create free account
hub / github.com/SparkPost/node-sparkpost / handleOptions

Function handleOptions

lib/sparkpost.js:23–35  ·  view source on GitHub ↗
(apiKey, options)

Source from the content-addressed store, hash-verified

21};
22
23const handleOptions = function(apiKey, options) {
24 if (typeof apiKey === 'object') {
25 options = apiKey;
26 options.key = process.env.SPARKPOST_API_KEY;
27 } else {
28 options = options || {};
29 options.key = apiKey;
30 }
31
32 options.origin = options.origin || options.endpoint || defaults.origin;
33
34 return options;
35};
36
37const createSparkPostError = function(res, body) {
38 const err = new Error(res.statusMessage);

Callers 1

SparkPostFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected