New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ee-templates

Package Overview
Dependencies
Maintainers
2
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ee-templates - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

27

lib/renderer/Factory.js

@@ -9,24 +9,15 @@ "use strict";

/**
*
* todo: add cache
*/
var Factory = {
rendererCache: null
dataPropertyName: null
, container: null
, environments: null
, init: function initialize(container) {
this.container = container;
this.rendererCache = {
items: {}
, get: function(key){
return this.has(key) ? this.items[key] : null;
}
, set: function(key, value){
this.items[key] = value;
}
, has: function(key){
return this.items.hasOwnProperty(key);
}
};
, init: function initialize(container, dataPropertyName) {
this.dataPropertyName = dataPropertyName || 'data';
this.container = container;
}

@@ -74,3 +65,3 @@

var host = request.hostname;
return new HTMLRenderer(this.container.get(host));
return new HTMLRenderer(this.container.get(host), this.dataPropertyName);
}

@@ -77,0 +68,0 @@ };

@@ -6,6 +6,8 @@ "use strict";

var HTMLRenderer = {
env: null
, init: function initialize(env) {
, init: function initialize(env, dataPropertyName) {
this.env = env;
this.propertyName = dataPropertyName;
}

@@ -16,5 +18,13 @@

* todo: remove the try catch block as soon as we are sure the rendering does not throw errors anymore (nunjucks)
* todo: try to find a better solution for the data assignment!!
*/
var ctx = {};
if(!!this.propertyName){
ctx[this.propertyName] = data.content;
} else {
ctx = data.content;
}
try {
this.env.render(data.template, data.content, function(err, content){
this.env.render(data.template, ctx, function(err, content){
return callback(err, content, 'text/html');

@@ -21,0 +31,0 @@ });

{
"name" : "ee-templates"
, "description" : "Templating integration for the ee-soa-transport-rest based on Nunjucks"
, "version" : "0.2.0"
, "version" : "0.2.1"
, "license" : "MIT"

@@ -6,0 +6,0 @@ , "author" : "Michael Rüfenacht <ruefe@rcky.ch> (http://www.rcky.ch)"

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc