Created
March 29, 2013 16:06
-
-
Save bebraw/5271769 to your computer and use it in GitHub Desktop.
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
var ctx = { | |
name: 'jude' | |
}; | |
var tpl = "hey {{ name }}, don't make it bad"; | |
var res = tpl.replace(/\{\{([a-zA-Z ]*)\}\}/g, function(m, g) { | |
return ctx[g.trim()]; | |
}); | |
console.log(res); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment