Created
April 24, 2019 13:38
-
-
Save danigb/506439c2952f61070c2df88cbbe872cc 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 PATTERN = new RegExp("{([a-z]+)}", "gi"); | |
function tmpl(template, data) { | |
return template.replace(PATTERN, function(tag, token) { | |
return data[token]; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment