brandingbrand/handlebars.js — pull request #2 by spookways (2014-03-26 22:02:13+00:00)
Title: Use the ('' + string) form of string coercion

This change will make it so the string will be displayed as undefined instead of making the server crash.

Original message:
Using string.toString() will throw errors in current versions of Safari
(6.0.5 currently) for some values. The error is a particularly cryptic
"Type Error: type error", which no indication as to the value that
caused the error. By using the '' + string form of coercion the error
doesn't seem to occur.

Depending on the browser used there is a sizable performance increase
in using the concatenation form of coercion. In instances where there
is not a performance improvement (i.e. Firefox), the speed difference
is entirely negligable. See: http://jsperf.com/convert-to-string-bj/3