5
5
*
6
6
* @param options object that contains initial values
7
7
*/
8
- function Email ( options ) {
9
- for ( var option in options ) {
8
+ function Email ( options ) {
9
+ var option ;
10
+ for ( option in options ) {
10
11
this [ option ] = options [ option ] ;
11
12
}
12
13
}
@@ -17,85 +18,85 @@ function Email(options){
17
18
* @param Most have a single value to map
18
19
* Add functions will often contain a key / value pair
19
20
*/
20
- Email . prototype . addTo = function ( address ) {
21
- if ( this . to === undefined ) {
21
+ Email . prototype . addTo = function ( address ) {
22
+ if ( this . to === undefined ) {
22
23
this . to = address ;
23
- } else if ( typeof this . to === 'string' ) {
24
+ } else if ( typeof this . to === 'string' ) {
24
25
this . to = [ this . to ] ;
25
26
this . to . push ( address ) ;
26
27
} else {
27
28
this . to . push ( address ) ;
28
29
}
29
30
} ;
30
- Email . prototype . setFrom = function ( address ) {
31
+ Email . prototype . setFrom = function ( address ) {
31
32
this . from = address ;
32
33
} ;
33
- Email . prototype . setSubject = function ( subject ) {
34
+ Email . prototype . setSubject = function ( subject ) {
34
35
this . subject = subject ;
35
36
} ;
36
- Email . prototype . setText = function ( text ) {
37
+ Email . prototype . setText = function ( text ) {
37
38
this . text = text ;
38
39
} ;
39
- Email . prototype . setHtml = function ( html ) {
40
+ Email . prototype . setHtml = function ( html ) {
40
41
this . html = html ;
41
42
} ;
42
- Email . prototype . addHeader = function ( key , value ) {
43
- if ( this . headers === undefined ) {
43
+ Email . prototype . addHeader = function ( key , value ) {
44
+ if ( this . headers === undefined ) {
44
45
this . headers = { } ;
45
46
}
46
47
this . headers [ key ] = value ;
47
48
} ;
48
- Email . prototype . setHeaders = function ( headers ) {
49
+ Email . prototype . setHeaders = function ( headers ) {
49
50
this . headers = headers ;
50
51
} ;
51
- Email . prototype . addSubstitution = function ( key , value ) {
52
- if ( this . sub === undefined ) {
52
+ Email . prototype . addSubstitution = function ( key , value ) {
53
+ if ( this . sub === undefined ) {
53
54
this . sub = { } ;
54
55
}
55
- if ( typeof value === 'string' ) {
56
+ if ( typeof value === 'string' ) {
56
57
this . sub [ key ] = [ value ] ;
57
58
} else {
58
59
this . sub [ key ] = value ;
59
60
}
60
61
} ;
61
- Email . prototype . setSubstitutions = function ( substitutions ) {
62
+ Email . prototype . setSubstitutions = function ( substitutions ) {
62
63
this . sub = substitutions ;
63
64
} ;
64
- Email . prototype . addSection = function ( key , value ) {
65
- if ( this . section === undefined ) {
65
+ Email . prototype . addSection = function ( key , value ) {
66
+ if ( this . section === undefined ) {
66
67
this . section = { } ;
67
68
}
68
69
this . section [ key ] = value ;
69
70
} ;
70
- Email . prototype . setSections = function ( sections ) {
71
+ Email . prototype . setSections = function ( sections ) {
71
72
this . section = sections ;
72
73
} ;
73
74
// SparkPost doesn't currently support addUniqueArg, throw an error
74
- Email . prototype . addUniqueArg = function ( ) {
75
+ Email . prototype . addUniqueArg = function ( ) {
75
76
throw new Error ( 'Unique Argument compatibility is not supported.' ) ;
76
77
} ;
77
78
// SparkPost doesn't currently support setUniqueArgs, throw an error
78
- Email . prototype . setUniqueArgs = function ( ) {
79
+ Email . prototype . setUniqueArgs = function ( ) {
79
80
throw new Error ( 'Unique Argument compatibility is not supported.' ) ;
80
81
} ;
81
82
// SparkPost doesn't currently support addCategory, throw an error
82
- Email . prototype . addCategory = function ( ) {
83
+ Email . prototype . addCategory = function ( ) {
83
84
throw new Error ( 'Category compatibility is not supported.' ) ;
84
85
} ;
85
86
// SparkPost doesn't currently support setCategories, throw an error
86
- Email . prototype . setCategories = function ( ) {
87
+ Email . prototype . setCategories = function ( ) {
87
88
throw new Error ( 'Category compatibility is not supported.' ) ;
88
89
} ;
89
90
// SparkPost doesn't currently support addFilter, throw an error
90
- Email . prototype . addFilter = function ( ) {
91
+ Email . prototype . addFilter = function ( ) {
91
92
throw new Error ( 'Filter compatibility is not supported.' ) ;
92
93
} ;
93
94
// SparkPost doesn't currently support setFilters, throw an error
94
- Email . prototype . setFilters = function ( ) {
95
+ Email . prototype . setFilters = function ( ) {
95
96
throw new Error ( 'Filter compatibility is not supported.' ) ;
96
97
} ;
97
98
// SparkPost doesn't currently support addFile, throw an error
98
- Email . prototype . addFile = function ( ) {
99
+ Email . prototype . addFile = function ( ) {
99
100
throw new Error ( 'File compatibility is not supported.' ) ;
100
101
} ;
101
102
0 commit comments