Comment #3 on issue 22 by [email protected]: JavaScript JSONTemplate cannot  
be prototyped
http://code.google.com/p/json-template/issues/detail?id=22

OK, this looks good basically, but are these two lines strictly necessary?

+  if(!(this instanceof Template)) // run as `Template()` instead of `new  
Template()`
+    return new Template(template_str, options);

You're supposed make a template like:

var t = Template("foo");

not

var t = new Template("foo");

Are you only protecting against the latter case?  If so I would just leave  
it out and
document it well in the examples and tests.

I pretty much learned JavaScript from Crockford's latest book, and he says  
he never
uses "new" anymore, if I recall correctly.


--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JSON 
Template" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/json-template?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to