Last active
January 5, 2016 03:58
-
-
Save hellerve/6a4aed746795ae36fb7a to your computer and use it in GitHub Desktop.
The Poor Man's Templating Engine In JS
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
function templating(template, values) { | |
for(var k in values) { | |
template = template.replace('{{' + k.toString() + '}}', values[k].toString()); | |
} | |
return template; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment