Created
June 18, 2015 06:58
-
-
Save lsongdev/81cfb09a697cc6627ff9 to your computer and use it in GitHub Desktop.
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
| var tmpl = function(str, data){ | |
| return str.replace(/#{([\s\S]*?)}/g, function(matchs, key){ | |
| return data[key.trim()] || ''; | |
| }); | |
| }; | |
| tmpl("My name is #{name} .", { name: 'lsong' }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment