This file contains hidden or 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
| /** | |
| * Allow for some super easy templating | |
| * @param {Object} ctx The context when you pass in an object literal | |
| * ------------------------------------------------------------------ | |
| * Works like this: | |
| * var People = { name: 'bob', age: 123, decades: function() { return parseInt(this.age/10); } } | |
| * var my_tpl = "Hi, my name is {{ name }} and I'm {{ age }} years old (that's {{ decades }} decades!)." | |
| * my_tpl.template(People); // Outputs: "Hi, my name is bob and I'm 123 years old"; | |
| */ | |
| String.prototype.template = function(data){ |