Skip to content

Commit e218c42

Browse files
Cast substitution values to strings
This allows for numbers as well as strings for substitution values. Could still use some type checking and error handling to inform the user if they send an object (which also has a `toString` method, so won't throw) or other invalid value type. Fixes #282.
1 parent ac1818c commit e218c42

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/helpers/mail/mail.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,8 +622,8 @@ function Personalization() {
622622
if (this.substitutions === undefined) {
623623
this.substitutions = {};
624624
}
625-
this.substitutions[Object.keys(substitution)[0]] =
626-
substitution[Object.keys(substitution)[0]];
625+
var currentKey = Object.keys(substitution)[0];
626+
this.substitutions[currentKey] = substitution[currentKey].toString();
627627
};
628628

629629
this.getSubstitutions = function() {

0 commit comments

Comments
 (0)