Skip to content
This repository has been archived by the owner on Apr 11, 2018. It is now read-only.

Commit

Permalink
appeasing crockford and jslint
Browse files Browse the repository at this point in the history
  • Loading branch information
paularmstrong committed Apr 11, 2012
1 parent 5fbeca0 commit 84bcd14
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
11 changes: 5 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,11 @@ function createTemplate(data, id) {
template.render = function (context, parents) {
if (_config.allowErrors) {
return render.call(this, context, parents, _config.filters, _, _config.extensions);
} else {
try {
return render.call(this, context, parents, _config.filters, _, _config.extensions);
} catch (e) {
return new TemplateError(e);
}
}
try {
return render.call(this, context, parents, _config.filters, _, _config.extensions);
} catch (e) {
return new TemplateError(e);
}
};

Expand Down
13 changes: 6 additions & 7 deletions lib/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ exports.escape = exports.e = function (input, type) {
.replace(/>/g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''');
} else {
return input;
}
return input;
};

exports.first = function (input) {
Expand All @@ -119,15 +118,16 @@ exports.first = function (input) {
exports.join = function (input, separator) {
if (_.isArray(input)) {
return input.join(separator);
} else if (typeof input === 'object') {
}

if (typeof input === 'object') {
var out = [];
_.each(input, function (value, key) {
out.push(value);
});
return out.join(separator);
} else {
return input;
}
return input;
};

exports.json_encode = function (input) {
Expand Down Expand Up @@ -171,9 +171,8 @@ exports.replace = function (input, search, replacement, flags) {
exports.reverse = function (input) {
if (_.isArray(input)) {
return input.reverse();
} else {
return input;
}
return input;
};

exports.striptags = function (input) {
Expand Down
6 changes: 3 additions & 3 deletions lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,8 @@ function check(variable, context) {
output[output.length - 1] = _.last(output).replace(/\] !== "undefined"$/, '_' + prop + '] !== "undefined"');
chain = chain.replace(/\]$/, '_' + prop + ']');
return;
} else {
chain += '[___' + prop + ']';
}
chain += '[___' + prop + ']';
} else {
chain += '[' + prop + ']';
}
Expand Down Expand Up @@ -149,7 +148,8 @@ exports.escapeVarName = function (variable, context) {

if (exports.isLiteral(variable)) {
return variable;
} else if (typeof context === 'string' && context.length) {
}
if (typeof context === 'string' && context.length) {
variable = context + '.' + variable;
}

Expand Down

0 comments on commit 84bcd14

Please sign in to comment.