Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

hbs

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hbs - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

3

lib/hbs.js

@@ -33,1 +33,4 @@ var handlebars = require('handlebars');

};
exports.SafeString = handlebars.SafeString;
exports.Utils = handlebars.Utils;

2

package.json
{
"name": "hbs",
"description": "Express.js template engine plugin for Handlebars",
"version": "1.0.0",
"version": "1.0.1",
"homepage": "https://github.com/donpark/hbs",

@@ -6,0 +6,0 @@ "author": "Don Park <donpark@docuverse.com> (http://blog.docuverse.com)",

@@ -29,3 +29,3 @@ # hbs #

Block Helper support is broken currently.
`__get__` function is not supported within block helper functions.

@@ -32,0 +32,0 @@ ## Migrating to 1.0.0 ##

@@ -7,3 +7,6 @@

var express = require('express');
var util = require('util');
var test_local_hbs = true;
var hbs = require(test_local_hbs ? '../../lib/hbs' : 'hbs');
/**

@@ -14,4 +17,5 @@ * HACK: Install local `hbs` view engine for testing purpose.

*/
var hbs = require('../../lib/hbs');
express.view.register('.hbs', hbs);
if (test_local_hbs) {
express.view.register('.hbs', hbs);
}

@@ -49,9 +53,10 @@ var app = module.exports = express.createServer();

hbs.registerHelper('link', function(context, fn) {
return '<a href="/people/' + this.__get__("id") + '">' + fn(this) + '</a>';
hbs.registerHelper('list', function(items, fn) {
var out = "<ul>";
for(var i=0, l=items.length; i<l; i++) {
out = out + "<li>" + fn(items[i]) + "</li>";
}
return out + "</ul>";
});
/*
<h3>Handlebars Block Helper Test</h3>
<ul>{{#people}}<li>{{#link}}{{name}}{{/link}}</li>{{/people}}</ul>
*/
hbs.registerPartial('link2', '<a href="/people/{{id}}">{{name}}</a>');

@@ -76,9 +81,18 @@

posts2: [{url: "/hello-world", body: "Hello World!"}],
// block helper
// for block helper test
people: [
{firstName: "Yehuda", lastName: "Katz"},
{firstName: "Carl", lastName: "Lerche"},
{firstName: "Alan", lastName: "Johnson"}
],
people2: [
{ name: { firstName: "Yehuda", lastName: "Katz" } },
{ name: { firstName: "Carl", lastName: "Lerche" } },
{ name: { firstName: "Alan", lastName: "Johnson" } }
],
// for partial test
people3: [
{ "name": "Alan", "id": 1 },
{ "name": "Yehuda", "id": 2 }
],
// partial
]
});

@@ -85,0 +99,0 @@ });

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