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

handlebars

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

handlebars - npm Package Compare versions

Comparing version 1.0.2-beta to 1.0.4-beta

4

lib/handlebars/base.js

@@ -89,2 +89,6 @@ // BEGIN(BROWSER)

Handlebars.registerHelper('log', function(context) {
Handlebars.log(context);
});
// END(BROWSER)

@@ -91,0 +95,0 @@

55

lib/handlebars/compiler/compiler.js

@@ -107,3 +107,4 @@ var Handlebars = require("./base");

'unless': true,
'with': true
'with': true,
'log': true
};

@@ -318,8 +319,9 @@ if (knownHelpers) {

nameLookup: function(parent, name, type) {
if(JavaScriptCompiler.RESERVED_WORDS[name] || name.indexOf('-') !== -1 || !isNaN(name)) {
return parent + "['" + name + "']";
} else if (/^[0-9]+$/.test(name)) {
if (/^[0-9]+$/.test(name)) {
return parent + "[" + name + "]";
} else {
return parent + "." + name;
} else if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) {
return parent + "." + name;
}
else {
return parent + "['" + name + "']";
}

@@ -339,2 +341,4 @@ },

},
namespace: "Handlebars",
// END PUBLIC API

@@ -410,4 +414,5 @@

if (!this.isChild) {
var copies = "helpers = helpers || Handlebars.helpers;";
if(this.environment.usePartial) { copies = copies + " partials = partials || Handlebars.partials;"; }
var namespace = this.namespace;
var copies = "helpers = helpers || " + namespace + ".helpers;";
if(this.environment.usePartial) { copies = copies + " partials = partials || " + namespace + ".partials;"; }
out.push(copies);

@@ -467,4 +472,2 @@ } else {

if(params.length === 4 && !this.environment.usePartial) { params.pop(); }
if (asObject) {

@@ -530,2 +533,3 @@ params.push(this.source.join("\n "));

toPush += ';';
this.source.push(toPush);

@@ -539,3 +543,4 @@ } else {

var topStack = this.topStack();
this.source.push(topStack + " = " + this.nameLookup(topStack, name, 'context') + ";");
this.source.push(topStack + " = (" + topStack + " === null || " + topStack + " === undefined || " + topStack + " === false ? " +
topStack + " : " + this.nameLookup(topStack, name, 'context') + ");");
},

@@ -734,3 +739,3 @@

var reservedWords = ("break case catch continue default delete do else finally " +
"for function if in instanceof new return switch this throw " +
"for function if in instanceof new return switch this throw " +
"try typeof var void while with null true false").split(" ");

@@ -744,2 +749,9 @@

JavaScriptCompiler.isValidJavaScriptVariableName = function(name) {
if(!JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(name)) {
return true;
}
return false;
}
})(Handlebars.Compiler, Handlebars.JavaScriptCompiler);

@@ -758,6 +770,17 @@

var ast = Handlebars.parse(string);
var environment = new Handlebars.Compiler().compile(ast, options);
var templateSpec = new Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true);
return Handlebars.template(templateSpec);
var compiled;
function compile() {
var ast = Handlebars.parse(string);
var environment = new Handlebars.Compiler().compile(ast, options);
var templateSpec = new Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true);
return Handlebars.template(templateSpec);
}
// Template is only compiled on first use and cached after that point.
return function(context, options) {
if (!compiled) {
compiled = compile();
}
return compiled.call(this, context, options);
};
};

@@ -764,0 +787,0 @@

@@ -444,10 +444,12 @@ /* Jison generated parser */

break;
case 23: return 'INVALID';
case 23: yy_.yytext = yy_.yytext.substr(1, yy_.yyleng-2); return 33;
break;
case 24: return 5;
case 24: return 'INVALID';
break;
case 25: return 5;
break;
}
};
lexer.rules = [/^[^\x00]*?(?=(\{\{))/,/^[^\x00]+/,/^\{\{>/,/^\{\{#/,/^\{\{\//,/^\{\{\^/,/^\{\{\s*else\b/,/^\{\{\{/,/^\{\{&/,/^\{\{![\s\S]*?\}\}/,/^\{\{/,/^=/,/^\.(?=[} ])/,/^\.\./,/^[/.]/,/^\s+/,/^\}\}\}/,/^\}\}/,/^"(\\["]|[^"])*"/,/^true(?=[}\s])/,/^false(?=[}\s])/,/^[0-9]+(?=[}\s])/,/^[a-zA-Z0-9_$-]+(?=[=}\s/.])/,/^./,/^$/];
lexer.conditions = {"mu":{"rules":[2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24],"inclusive":false},"INITIAL":{"rules":[0,1,24],"inclusive":true}};return lexer;})()
lexer.rules = [/^[^\x00]*?(?=(\{\{))/,/^[^\x00]+/,/^\{\{>/,/^\{\{#/,/^\{\{\//,/^\{\{\^/,/^\{\{\s*else\b/,/^\{\{\{/,/^\{\{&/,/^\{\{![\s\S]*?\}\}/,/^\{\{/,/^=/,/^\.(?=[} ])/,/^\.\./,/^[/.]/,/^\s+/,/^\}\}\}/,/^\}\}/,/^"(\\["]|[^"])*"/,/^true(?=[}\s])/,/^false(?=[}\s])/,/^[0-9]+(?=[}\s])/,/^[a-zA-Z0-9_$-]+(?=[=}\s/.])/,/^\[.*\]/,/^./,/^$/];
lexer.conditions = {"mu":{"rules":[2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],"inclusive":false},"INITIAL":{"rules":[0,1,25],"inclusive":true}};return lexer;})()
parser.lexer = lexer;

@@ -454,0 +456,0 @@ return parser;

{
"name": "handlebars",
"description": "Extension of the Mustache logicless template language",
"version": "1.0.2beta",
"version": "1.0.4beta",
"homepage": "http://www.handlebarsjs.com/",

@@ -15,4 +15,4 @@ "keywords": "handlebars mustache template html",

"dependencies": {
"optimist": "~0.2",
"uglify-js": "~1.0"
"optimist": "~0.3",
"uglify-js": "~1.2"
},

@@ -19,0 +19,0 @@ "devDependencies": {},

Sorry, the diff of this file is not supported yet

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