Created
August 12, 2010 17:52
-
-
Save premasagar/521352 to your computer and use it in GitHub Desktop.
A tiny, secure JavaScript micro-templating script. It doesn't use eval or (new Function), so it cannot execute malicious code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
== Tim == | |
A tiny, secure JavaScript micro-templating script. | |
This has now moved to: | |
github.com/premasagar/tim | |
*/ |
Aha! Thanks, Aron. You are right. Updated the Gist...
Awesome prem, I'm so going to use that in projects from now on.
Great. Please do, Michael. Let me know if you put it to good use.
I just added a little debugging block, to help track down missing properties in the data object, and an option third argument "notFound", which can be used as the default string when a property is not found in the data object. See the notes at the top of the script.
(BTW - I'm probably going to spin this off into its own GitHub project repository soon).
I've now moved Tim to http://github.com/premasagar/tim
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey Prem,
What a useful little function. I don't think you need to slice the tag on line 53 as the captured tokens are passed as arguments into the callback function. eg.
Unless you're doing it for another reason?