email-templates
Advanced tools
Comparing version 2.3.0 to 2.3.1
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
@@ -7,6 +11,2 @@ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _bluebird = require('bluebird'); | ||
@@ -85,2 +85,3 @@ | ||
if (!html && !text) { | ||
@@ -170,2 +171,4 @@ var err = new Error('Neither html nor text template files found or are both empty in path ' + _this2.dirname); | ||
locals = {}; | ||
} else if (locals) { | ||
locals = (0, _assign2.default)({}, locals); | ||
} | ||
@@ -172,0 +175,0 @@ debug('Rendering template with locals %j', locals); |
@@ -15,2 +15,3 @@ 'use strict'; | ||
function exportable(templateDirectory, options, done) { | ||
@@ -17,0 +18,0 @@ if (isFunction(options)) { |
@@ -45,2 +45,3 @@ 'use strict'; | ||
return new _bluebird2.default(function (resolve, reject) { | ||
@@ -47,0 +48,0 @@ if (!content) return reject('No content in template'); |
{ | ||
"name": "email-templates", | ||
"description": "Node.js module for rendering beautiful emails with ejs, jade, swig, hbs, or handlebars templates and email-friendly inline CSS using juice.", | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"author": "Nick Baugh <niftylettuce@gmail.com>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -116,2 +116,4 @@ import P from 'bluebird' | ||
locals = {} | ||
} else if (locals) { | ||
locals = assign({}, locals) | ||
} | ||
@@ -118,0 +120,0 @@ debug('Rendering template with locals %j', locals) |
@@ -123,2 +123,19 @@ /* global describe it beforeEach afterEach */ | ||
it('render calls should not mutate view data', function (done) { | ||
var html = '<style> h4 { color: red; }</style><h4><%= item %></h4>' | ||
var css = 'h4 { color: blue; }' | ||
fs.writeFileSync(path.join(templatePath, 'html.ejs'), html) | ||
fs.writeFileSync(path.join(templatePath, 'style.ejs'), css) | ||
var et = new EmailTemplate(templatePath) | ||
var locals = { item: 'test' } | ||
et.render(locals) | ||
.then(function (results) { | ||
expect(locals).to.eql({ item: 'test' }) | ||
done() | ||
}) | ||
.catch(done) | ||
}) | ||
describe('when include sass from another directory', function () { | ||
@@ -125,0 +142,0 @@ beforeEach(function (done) { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
76518
36
1640