Socket
Socket
Sign inDemoInstall

derby-templates

Package Overview
Dependencies
2
Maintainers
4
Versions
45
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.7.3 to 0.7.4

40

lib/templates.js

@@ -197,2 +197,3 @@ var saddle = require('saddle');

this.componentFactory = null;
this.fromSerialized = false;
}

@@ -505,8 +506,18 @@ View.prototype = Object.create(saddle.Template.prototype);

};
Views.prototype.deserialize = function(items) {
for (var i = 0; i < items.length; i++) {
var item = items[i];
var setTemplate = item[0];
var name = item[1];
var source = item[2];
var options = item[3];
var view = this.register(name, source, options);
view.parse = setTemplate;
view.fromSerialized = true;
}
};
Views.prototype.serialize = function(options) {
var out = 'function(derbyTemplates, views) {' +
'var expressions = derbyTemplates.expressions;' +
'var templates = derbyTemplates.templates;';
var forServer = options && options.server;
var minify = options && options.minify;
var items = [];
for (var name in this.nameMap) {

@@ -524,9 +535,20 @@ var view = this.nameMap[name];

}
out += 'views.register(' + serializeObject.args([
view.name
, (minify) ? null : view.source
, (hasKeys(view.options)) ? view.options : null
]) + ').parse = function() {return this.template = ' + template.serialize() + '};';
// Serializing views as a function allows them to be constructed lazily upon
// first use. This can improve initial load times of the application when
// there are many views
items.push(
'[function(){return this.template=' +
template.serialize() + '},' +
serializeObject.args([
view.name,
(minify) ? null : view.source,
(hasKeys(view.options)) ? view.options : null
]) +
']'
);
}
return out + '}';
return 'function(derbyTemplates, views){' +
'var expressions = derbyTemplates.expressions,' +
'templates = derbyTemplates.templates;' +
'views.deserialize([' + items.join(',') + '])}';
};

@@ -533,0 +555,0 @@ Views.prototype.findErrorMessage = function(name, contextView) {

{
"name": "derby-templates",
"version": "0.7.3",
"version": "0.7.4",
"main": "index.js",

@@ -5,0 +5,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc