node-sendgrid
Advanced tools
Comparing version 0.0.2 to 0.0.3
{ | ||
"name": "node-sendgrid", | ||
"description": "SendGrid SMTP API headers library", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"homepage": "https://github.com/HerdHound/node-sendgrid", | ||
@@ -6,0 +6,0 @@ "keywords": ["email", "smtp", "sendgrid"], |
@@ -20,2 +20,6 @@ /** | ||
function addTo(to, headers) { | ||
if (!to) { | ||
return; | ||
} | ||
headers.to = headers.to || []; | ||
@@ -30,2 +34,6 @@ if (_.isString(to)) { | ||
function addSubVal(key, val, headers) { | ||
if (!key || !val) { | ||
return; | ||
} | ||
headers.sub = headers.sub || {}; | ||
@@ -40,2 +48,6 @@ if (_.isString(val)) { | ||
function addSubObj(sub, headers) { | ||
if (!sub) { | ||
return; | ||
} | ||
headers.sub = headers.sub || {}; | ||
@@ -47,2 +59,6 @@ // Shallow-copy properties from sub to headers.sub | ||
function setUniqueArgs(obj, headers) { | ||
if (!obj) { | ||
return; | ||
} | ||
headers.unique_args = obj; | ||
@@ -52,2 +68,6 @@ } | ||
function setCategory(category, headers) { | ||
if (!category) { | ||
return; | ||
} | ||
if (_.isString(category)) { | ||
@@ -59,2 +79,6 @@ headers.category = category; | ||
function addFilterSetting(filter, setting, val, headers) { | ||
if (!filter || !setting || !val) { | ||
return; | ||
} | ||
headers.filters = headers.filters || {}; | ||
@@ -67,3 +91,7 @@ headers.filters[filter] = headers.filters[filter] || {}; | ||
function addFilterSettings(filter, settings, headers) { | ||
_.keys(settings).forEach(function(setting) { | ||
if (!filter || !settings) { | ||
return; | ||
} | ||
Object.keys(settings).forEach(function(setting) { | ||
addFilterSettings(filter, setting, settings[setting], headers); | ||
@@ -103,3 +131,3 @@ }); | ||
if (defaults.filters) { | ||
_.keys(defaults.filters).forEach(function(filter) { | ||
Object.keys(defaults.filters).forEach(function(filter) { | ||
addFilterSettings(filter, defaults.filters[filter], this.headers); | ||
@@ -106,0 +134,0 @@ }); |
Sorry, the diff of this file is not supported yet
11581
186