Skip to content

Commit

Permalink
Merge pull request #535 from sorentwo/alternate-string-coercion
Browse files Browse the repository at this point in the history
Use the String(string) form of string coercion
  • Loading branch information
kpdecker committed Aug 15, 2013
2 parents 860853d + d02c90c commit 18506e0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/handlebars/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Handlebars.SafeString = function(string) {
this.string = string;
};
Handlebars.SafeString.prototype.toString = function() {
return this.string.toString();
return "" + this.string;
};

var escape = {
Expand Down Expand Up @@ -60,7 +60,7 @@ Handlebars.Utils = {
// Force a string conversion as this will be done by the append regardless and
// the regex test will do this transparently behind the scenes, causing issues if
// an object's to string has escaped characters in it.
string = string.toString();
string = "" + string;

if(!possible.test(string)) { return string; }
return string.replace(badChars, escapeChar);
Expand Down

0 comments on commit 18506e0

Please sign in to comment.