Skip to content

Commit

Permalink
Merge pull request #3 from PatrickHeneise/patch-1
Browse files Browse the repository at this point in the history
Update lib/main.js
  • Loading branch information
niftylettuce committed Aug 5, 2012
2 parents bb43563 + 3a64de4 commit a46c4b5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/main.js
@@ -1,4 +1,3 @@

// node-email-templates
// Copyright (c) 2012 Nick Baugh <niftylettuce@gmail.com>
// MIT Licensed
Expand All @@ -24,7 +23,7 @@ var EmailTemplate = function(templateDirectory, done) {
this.text = '';
this.stylesheet = '';
this.render = function(locals, html, text, stylesheet, callback) {
if (html instanceof Function) {
if (typeof html === 'function') {
callback = html;
html = that.html;
text = that.text;
Expand All @@ -33,7 +32,7 @@ var EmailTemplate = function(templateDirectory, done) {
html = ejs.render(html, locals);
text = (text) ? ejs.render(text, locals) : '';
if (stylesheet) html = juice(html, stylesheet);
if (html instanceof Function) callback = html;
if (typeof html === 'function') callback = html;
return callback(null, html, text);
};

Expand All @@ -54,10 +53,10 @@ var EmailTemplate = function(templateDirectory, done) {

// Fallback if user doesn't pass all the args
var batchEmail = false;
if (typeof locals !== 'undefined' && locals instanceof Function) {
if (typeof locals !== 'undefined' && typeof locals === 'function') {
callback = locals;
locals = {};
} else if (typeof callback !== 'undefined' && callback instanceof Function) {
} else if (typeof callback !== 'undefined' && typeof callback === 'function') {
if (typeof locals === 'undefined' || !locals instanceof Object) {
locals = {};
} else if (locals === true) {
Expand Down

0 comments on commit a46c4b5

Please sign in to comment.