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

co-nested-hbs

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

co-nested-hbs - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

24

index.js

@@ -37,8 +37,3 @@ var fs = require('fs');

function* renderTemplate(viewPath, partialsPath, tmpl, locals) {
if (!registeredPartials) {
yield registerPartials(partialsPath);
registeredPartials = true;
}
function* renderTemplate(tmpl, locals) {
if (!tmpl.endsWith('.hbs')) {

@@ -49,3 +44,3 @@ tmpl = tmpl + '.hbs';

if(!hbsCache[tmpl]) {
var rawTemplate = yield read(path.join(viewPath, tmpl));
var rawTemplate = yield read(tmpl);
hbsCache[tmpl] = handlebars.compile(rawTemplate);

@@ -81,2 +76,7 @@ }

if (!registeredPartials) {
yield registerPartials(opts.partialsPath);
registeredPartials = true;
}
lastArg = arguments[arguments.length - 1];

@@ -102,7 +102,5 @@ secondToLastArg = arguments[arguments.length - 2];

if (renderOpts.viewPathPrefix) {
templates = templates.map(function(tmpl) {
return path.join(renderOpts.viewPathPrefix, tmpl);
});
}
templates = templates.map(function(tmpl) {
return path.join(viewPath, tmpl);
});

@@ -122,3 +120,3 @@ if (renderOpts.layout !== false) {

buffer = yield renderTemplate(viewPath, opts.partialsPath, tmpl, locals);
buffer = yield renderTemplate(tmpl, locals);
}

@@ -125,0 +123,0 @@

{
"name": "co-nested-hbs",
"version": "0.2.1",
"version": "0.3.0",
"repository": "speedmanly/co-nested-hbs",

@@ -5,0 +5,0 @@ "description": "Generator-based Handlebars templates for nested layouts.",

@@ -20,3 +20,3 @@ var assert = require('assert');

co(function *() {
var view = require('..')('test', {layout: 'a'}),
var view = require('..')('test', {layout: 'test/a'}),
html = yield view.render('c');

@@ -30,3 +30,3 @@

co(function *() {
var view = require('..')('test', {layouts: ['b', 'a']}),
var view = require('..')('test', {layouts: ['test/b', 'test/a']}),
html = yield view.render('c');

@@ -91,4 +91,4 @@

co(function *() {
var view = require('..')('test', {layout: 'a'}),
html = yield view.render('c', {}, {layout: 'b'});
var view = require('..')('test', {layout: 'test/a'}),
html = yield view.render('c', {}, {layout: 'test/b'});

@@ -99,10 +99,11 @@ assert.equal(html, '<b>c\n</b>\n');

it('takes a last argument to prefix the given templates', function(done) {
it('ignores a null layout', function(done) {
co(function *() {
var view = require('..')('test'),
html = yield view.render('test', {}, {viewPathPrefix: 'test'});
var view = require('..')('test', {layout: 'test/a'}),
html = yield view.render('c', {}, {layout: null});
assert.equal(html, 'test\n');
assert.equal(html, '<a>c\n</a>\n');
})(done);
});
});
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