55 *
66 * @param options object that contains initial values
77 */
8- function Email ( options ) {
9- for ( var option in options ) {
8+ function Email ( options ) {
9+ var option ;
10+ for ( option in options ) {
1011 this [ option ] = options [ option ] ;
1112 }
1213}
@@ -17,85 +18,85 @@ function Email(options){
1718 * @param Most have a single value to map
1819 * Add functions will often contain a key / value pair
1920 */
20- Email . prototype . addTo = function ( address ) {
21- if ( this . to === undefined ) {
21+ Email . prototype . addTo = function ( address ) {
22+ if ( this . to === undefined ) {
2223 this . to = address ;
23- } else if ( typeof this . to === 'string' ) {
24+ } else if ( typeof this . to === 'string' ) {
2425 this . to = [ this . to ] ;
2526 this . to . push ( address ) ;
2627 } else {
2728 this . to . push ( address ) ;
2829 }
2930} ;
30- Email . prototype . setFrom = function ( address ) {
31+ Email . prototype . setFrom = function ( address ) {
3132 this . from = address ;
3233} ;
33- Email . prototype . setSubject = function ( subject ) {
34+ Email . prototype . setSubject = function ( subject ) {
3435 this . subject = subject ;
3536} ;
36- Email . prototype . setText = function ( text ) {
37+ Email . prototype . setText = function ( text ) {
3738 this . text = text ;
3839} ;
39- Email . prototype . setHtml = function ( html ) {
40+ Email . prototype . setHtml = function ( html ) {
4041 this . html = html ;
4142} ;
42- Email . prototype . addHeader = function ( key , value ) {
43- if ( this . headers === undefined ) {
43+ Email . prototype . addHeader = function ( key , value ) {
44+ if ( this . headers === undefined ) {
4445 this . headers = { } ;
4546 }
4647 this . headers [ key ] = value ;
4748} ;
48- Email . prototype . setHeaders = function ( headers ) {
49+ Email . prototype . setHeaders = function ( headers ) {
4950 this . headers = headers ;
5051} ;
51- Email . prototype . addSubstitution = function ( key , value ) {
52- if ( this . sub === undefined ) {
52+ Email . prototype . addSubstitution = function ( key , value ) {
53+ if ( this . sub === undefined ) {
5354 this . sub = { } ;
5455 }
55- if ( typeof value === 'string' ) {
56+ if ( typeof value === 'string' ) {
5657 this . sub [ key ] = [ value ] ;
5758 } else {
5859 this . sub [ key ] = value ;
5960 }
6061} ;
61- Email . prototype . setSubstitutions = function ( substitutions ) {
62+ Email . prototype . setSubstitutions = function ( substitutions ) {
6263 this . sub = substitutions ;
6364} ;
64- Email . prototype . addSection = function ( key , value ) {
65- if ( this . section === undefined ) {
65+ Email . prototype . addSection = function ( key , value ) {
66+ if ( this . section === undefined ) {
6667 this . section = { } ;
6768 }
6869 this . section [ key ] = value ;
6970} ;
70- Email . prototype . setSections = function ( sections ) {
71+ Email . prototype . setSections = function ( sections ) {
7172 this . section = sections ;
7273} ;
7374// SparkPost doesn't currently support addUniqueArg, throw an error
74- Email . prototype . addUniqueArg = function ( ) {
75+ Email . prototype . addUniqueArg = function ( ) {
7576 throw new Error ( 'Unique Argument compatibility is not supported.' ) ;
7677} ;
7778// SparkPost doesn't currently support setUniqueArgs, throw an error
78- Email . prototype . setUniqueArgs = function ( ) {
79+ Email . prototype . setUniqueArgs = function ( ) {
7980 throw new Error ( 'Unique Argument compatibility is not supported.' ) ;
8081} ;
8182// SparkPost doesn't currently support addCategory, throw an error
82- Email . prototype . addCategory = function ( ) {
83+ Email . prototype . addCategory = function ( ) {
8384 throw new Error ( 'Category compatibility is not supported.' ) ;
8485} ;
8586// SparkPost doesn't currently support setCategories, throw an error
86- Email . prototype . setCategories = function ( ) {
87+ Email . prototype . setCategories = function ( ) {
8788 throw new Error ( 'Category compatibility is not supported.' ) ;
8889} ;
8990// SparkPost doesn't currently support addFilter, throw an error
90- Email . prototype . addFilter = function ( ) {
91+ Email . prototype . addFilter = function ( ) {
9192 throw new Error ( 'Filter compatibility is not supported.' ) ;
9293} ;
9394// SparkPost doesn't currently support setFilters, throw an error
94- Email . prototype . setFilters = function ( ) {
95+ Email . prototype . setFilters = function ( ) {
9596 throw new Error ( 'Filter compatibility is not supported.' ) ;
9697} ;
9798// SparkPost doesn't currently support addFile, throw an error
98- Email . prototype . addFile = function ( ) {
99+ Email . prototype . addFile = function ( ) {
99100 throw new Error ( 'File compatibility is not supported.' ) ;
100101} ;
101102
0 commit comments