Skip to content

Commit

Permalink
Merge pull request #84 from rosstuck/helper_args
Browse files Browse the repository at this point in the history
Detect helpers with single scalar parameters
  • Loading branch information
SlexAxton committed Jan 22, 2013
2 parents 6b0a5e0 + 5b25afb commit c9588f6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions hbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ define([
i18nDirectory = "template/i18n/",
buildCSSFileName = "screen.build.css";

Handlebars.registerHelper('$', function() {
//placeholder for translation helper
});

if (typeof window !== "undefined" && window.navigator && window.document && !window.navigator.userAgent.match(/Node.js/)) {
// Browser action
getXhr = function () {
Expand Down Expand Up @@ -225,9 +229,13 @@ define([
var paramsWithoutParts = ['this', '.', '..', './..', '../..', '../../..'];

// grab the params
if ( statement.params ) {
if ( statement.params && typeof Handlebars.helpers[statement.id.string] === 'undefined') {
_(statement.params).forEach(function(param) {
if ( _(paramsWithoutParts).contains(param.original) ) {
if ( _(paramsWithoutParts).contains(param.original)
|| param instanceof Handlebars.AST.StringNode
|| param instanceof Handlebars.AST.IntegerNode
|| param instanceof Handlebars.AST.BooleanNode
) {
helpersres.push(statement.id.string);
}

Expand Down

0 comments on commit c9588f6

Please sign in to comment.